Skip to content

Commit

Permalink
chore: revert the change from yield_now to sleep (#964)
Browse files Browse the repository at this point in the history
  • Loading branch information
carneiro-cw authored May 31, 2024
1 parent 6f0a8a3 commit 82f40f9
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/bin/importer_online.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ use stratus::utils::calculate_tps;
use stratus::GlobalServices;
use stratus::GlobalState;
use tokio::sync::mpsc;
use tokio::task::yield_now;
use tokio::time::sleep;
use tokio::time::timeout;

Expand Down Expand Up @@ -60,9 +61,6 @@ const PARALLEL_RECEIPTS: usize = 100;
/// Timeout awaiting for newHeads event before fallback to polling.
const TIMEOUT_NEW_HEADS: Duration = Duration::from_millis(2000);

/// Interval before we check again if we are behind the external rpc current block number.
const INTERVAL_CATCH_UP: Duration = Duration::from_millis(20);

/// Interval before we starting retrieving receipts because they are not immediately available after the block is retrieved.
const INTERVAL_FETCH_RECEIPTS: Duration = Duration::from_millis(50);

Expand Down Expand Up @@ -295,7 +293,7 @@ async fn start_block_fetcher(
// if we are ahead of current block number, await until we are behind again
let external_rpc_current_block = EXTERNAL_RPC_CURRENT_BLOCK.load(Ordering::Relaxed);
if importer_block_number.as_u64() > external_rpc_current_block {
sleep(INTERVAL_CATCH_UP).await;
yield_now().await;
continue;
}

Expand Down

0 comments on commit 82f40f9

Please sign in to comment.