Skip to content

Commit

Permalink
chore: use relaxed ordering for stop flag
Browse files Browse the repository at this point in the history
Signed-off-by: bsbds <[email protected]>
  • Loading branch information
bsbds authored and mergify[bot] committed Mar 5, 2024
1 parent 6fd37ec commit fced04c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/curp/src/server/storage/wal/pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ impl FilePipeline {
};
file_count += 1;

if stopped_c.load(Ordering::SeqCst) {
if stopped_c.load(Ordering::Relaxed) {
if let Err(e) = Self::clean_up(&dir_c) {
error!("failed to clean up pipeline files: {e}");
}
Expand All @@ -82,7 +82,7 @@ impl FilePipeline {

/// Stops the pipeline
pub(super) fn stop(&mut self) {
self.stopped.store(true, Ordering::SeqCst);
self.stopped.store(true, Ordering::Relaxed);
}

/// Allocates a a new tempfile
Expand Down Expand Up @@ -120,7 +120,7 @@ impl Stream for FilePipeline {
mut self: std::pin::Pin<&mut Self>,
cx: &mut std::task::Context<'_>,
) -> Poll<Option<Self::Item>> {
if self.stopped.load(Ordering::SeqCst) {
if self.stopped.load(Ordering::Relaxed) {
return Poll::Ready(None);
}

Expand Down

0 comments on commit fced04c

Please sign in to comment.