Skip to content

Commit

Permalink
Change atomic ordering for exit signal to relaxed
Browse files Browse the repository at this point in the history
  • Loading branch information
coderofstuff committed Dec 21, 2023
1 parent 4993db2 commit 9b33de6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion consensus/src/consensus/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,7 @@ impl Consensus {
}

pub fn signal_exit(&self) {
self.is_consensus_exiting.store(true, Ordering::SeqCst);
self.is_consensus_exiting.store(true, Ordering::Relaxed);
self.block_sender.send(BlockProcessingMessage::Exit).unwrap();
}

Expand Down
2 changes: 1 addition & 1 deletion consensus/src/pipeline/pruning_processor/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ impl PruningProcessor {
if lock_acquire_time.elapsed() > Duration::from_millis(5) {
drop(reachability_read);
// An exit signal was received. Exit from this long running process.
if self.is_consensus_exiting.load(Ordering::SeqCst) {
if self.is_consensus_exiting.load(Ordering::Relaxed) {
drop(prune_guard);
info!("Header and Block pruning interrupted: Process is exiting");
return;
Expand Down
2 changes: 1 addition & 1 deletion consensus/src/processes/pruning_proof/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -441,7 +441,7 @@ impl PruningProofManager {
let mut selected_tip_by_level = vec![None; self.max_block_level as usize + 1];
for level in (0..=self.max_block_level).rev() {
// Before processing this level, check if the process is exiting so we can end early
if self.is_consensus_exiting.load(Ordering::SeqCst) {
if self.is_consensus_exiting.load(Ordering::Relaxed) {
return Err(PruningImportError::PruningValidationInterrupted);
}

Expand Down

0 comments on commit 9b33de6

Please sign in to comment.