Skip to content

Commit

Permalink
Merge pull request #2187 from subspace/drain-notifications-after-dsn-…
Browse files Browse the repository at this point in the history
…sync

Drain notifications after DSN sync
  • Loading branch information
nazar-pc authored Nov 1, 2023
2 parents 678e812 + 753fdde commit a2e0899
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crates/subspace-service/src/sync_from_dsn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,10 +256,6 @@ where
while let Some(reason) = notifications.next().await {
let prev_sync_mode = sync_mode.swap(SyncMode::Paused, Ordering::AcqRel);

while notifications.try_next().is_ok() {
// Just drain extra messages if there are any
}

info!(?reason, "Received notification to sync from DSN");
// TODO: Maybe handle failed block imports, additional helpful logging
if let Err(error) = import_blocks_from_dsn(
Expand All @@ -280,6 +276,10 @@ where
initial_sync_mode.take().unwrap_or(prev_sync_mode),
Ordering::Release,
);

while notifications.try_next().is_ok() {
// Just drain extra messages if there are any
}
}

Ok(())
Expand Down

0 comments on commit a2e0899

Please sign in to comment.