From f521390834ae5fd7b7394fbeb20f1da4481ae875 Mon Sep 17 00:00:00 2001 From: Daniel Freire Date: Fri, 31 May 2024 12:31:07 -0300 Subject: [PATCH 1/2] chore: revert the change from yield_now to sleep --- src/bin/importer_online.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/bin/importer_online.rs b/src/bin/importer_online.rs index b2ef5500d..3953422fb 100644 --- a/src/bin/importer_online.rs +++ b/src/bin/importer_online.rs @@ -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; @@ -295,7 +296,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; } From 373d26198f13861f84ceb5f6bbe224421cca39be Mon Sep 17 00:00:00 2001 From: Daniel Freire Date: Fri, 31 May 2024 12:37:07 -0300 Subject: [PATCH 2/2] lint --- src/bin/importer_online.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/src/bin/importer_online.rs b/src/bin/importer_online.rs index 3953422fb..706d49d99 100644 --- a/src/bin/importer_online.rs +++ b/src/bin/importer_online.rs @@ -61,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);