Skip to content

Commit

Permalink
Allow initial fetching
Browse files Browse the repository at this point in the history
  • Loading branch information
squadgazzz committed Apr 20, 2024
1 parent 78649c2 commit 6b32c72
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions crates/solver/src/liquidity/zeroex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,6 @@ impl ZeroExLiquidity {
) {
let mut receiver = blocks_stream.clone();
loop {
if let Err(err) = receiver.changed().await {
tracing::error!(
?err,
"failed to receive block update during 0x liquidity fetching"
);
tokio::time::sleep(tokio::time::Duration::from_secs(1)).await;
continue;
}

let queries = &[
// orders fillable by anyone
OrdersQuery::default(),
Expand All @@ -131,8 +122,18 @@ impl ZeroExLiquidity {
})
.collect();

let mut cache = orderbook_cache.write().await;
*cache = zeroex_orders;
{
let mut cache = orderbook_cache.write().await;
*cache = zeroex_orders;
}

while let Err(err) = receiver.changed().await {
tracing::error!(
?err,
"failed to receive block update during 0x liquidity fetching"
);
tokio::time::sleep(tokio::time::Duration::from_secs(1)).await;
}
}
}
}
Expand Down

0 comments on commit 6b32c72

Please sign in to comment.