Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions chain-signatures/node/src/indexer_eth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -686,11 +686,12 @@ async fn add_new_block_to_process(
let mut receiver_state_update_timestamp = Instant::now();
loop {
interval.tick().await;
if block_heads_rx.is_empty()
&& receiver_state_update_timestamp.elapsed() > Duration::from_secs(60)
{
tracing::warn!("No new block heads received for 60 seconds, waiting...");
receiver_state_update_timestamp = Instant::now();
if block_heads_rx.is_empty() {
if receiver_state_update_timestamp.elapsed() > Duration::from_secs(60) {
tracing::warn!("No new block heads received for 60 seconds, waiting...");
receiver_state_update_timestamp = Instant::now();
}
continue;
Copy link

Copilot AI Aug 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The continue statement will skip the block_heads_rx.recv().await call entirely when the queue is empty, but this creates a busy loop that consumes CPU unnecessarily. The original logic allowed the recv().await call to block and wait for new messages, which is more efficient than continuously polling.

Copilot uses AI. Check for mistakes.
}
let new_block_head = match block_heads_rx.recv().await {
Ok(new_block_head) => new_block_head,
Expand Down
Loading