Skip to content

Commit

Permalink
Drain notifications after DSN sync
Browse files Browse the repository at this point in the history
  • Loading branch information
nazar-pc committed Oct 31, 2023
1 parent 678e812 commit 753fdde
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 753fdde

Please sign in to comment.