Skip to content

Commit

Permalink
Ensure sync status persists for two subsequent checks rather than jus…
Browse files Browse the repository at this point in the history
…t one
  • Loading branch information
nazar-pc committed Dec 24, 2023
1 parent b6b1fcf commit 9193bae
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions crates/sc-consensus-subspace-rpc/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -655,6 +655,18 @@ where

// Update subscriber if value has changed
if last_is_major_syncing != Some(is_major_syncing) {
// In case change is detected, wait for another interval to confirm.
// TODO: This is primarily because Substrate seems to lose peers for brief
// periods of time sometimes that needs to be investigated separately
futures_timer::Delay::new(NODE_SYNC_STATUS_CHECK_INTERVAL).await;

// If status returned back to what it was, ignore
if last_is_major_syncing == Some(sync_oracle.is_major_syncing()) {
futures_timer::Delay::new(NODE_SYNC_STATUS_CHECK_INTERVAL).await;
continue;
}

// Otherwise save new status
last_is_major_syncing.replace(is_major_syncing);

let node_sync_status = if is_major_syncing {
Expand Down

0 comments on commit 9193bae

Please sign in to comment.