Skip to content

Commit

Permalink
Fix legacy sync pausing code
Browse files Browse the repository at this point in the history
  • Loading branch information
nazar-pc committed Feb 19, 2024
1 parent ccd2067 commit d816afe
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions crates/subspace-service/src/sync_from_dsn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -249,9 +249,8 @@ where
.saturating_sub(chain_constants.confirmation_depth_k().into());
let segment_header_downloader = SegmentHeaderDownloader::new(node);

let mut initial_pause_sync = Some(pause_sync.load(Ordering::Acquire));
while let Some(reason) = notifications.next().await {
let prev_pause_sync = pause_sync.swap(true, Ordering::AcqRel);
pause_sync.swap(true, Ordering::AcqRel);

info!(?reason, "Received notification to sync from DSN");
// TODO: Maybe handle failed block imports, additional helpful logging
Expand Down Expand Up @@ -295,10 +294,7 @@ where
}
}

pause_sync.store(
initial_pause_sync.take().unwrap_or(prev_pause_sync),
Ordering::Release,
);
pause_sync.store(false, Ordering::Release);

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

0 comments on commit d816afe

Please sign in to comment.