From a41b193837d8a57e2749cae30f21bee729cfb165 Mon Sep 17 00:00:00 2001 From: Nazar Mokrynskyi Date: Tue, 20 Feb 2024 01:24:46 +0200 Subject: [PATCH] Fix legacy sync pausing code (#2541) --- crates/subspace-service/src/sync_from_dsn.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/crates/subspace-service/src/sync_from_dsn.rs b/crates/subspace-service/src/sync_from_dsn.rs index dd261061cb..9243ddafc3 100644 --- a/crates/subspace-service/src/sync_from_dsn.rs +++ b/crates/subspace-service/src/sync_from_dsn.rs @@ -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.store(true, Ordering::Release); info!(?reason, "Received notification to sync from DSN"); // TODO: Maybe handle failed block imports, additional helpful logging @@ -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