Skip to content

Commit

Permalink
Revert "fix(storage): ignore errors on shutdown. (#497)"
Browse files Browse the repository at this point in the history
This reverts commit bfff925.

Signed-off-by: Alex Chi <iskyzh@gmail.com>
  • Loading branch information
skyzh committed Feb 18, 2022
1 parent bfff925 commit 347f764
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/storage/secondary/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ impl SecondaryStorage {
Compactor::new(storage, rx)
.run()
.await
.expect("compactor stopped unexpectly");
.expect("compactor stopped unexpectedly");
})),
);

Expand All @@ -137,19 +137,15 @@ impl SecondaryStorage {
}

pub async fn shutdown(self: &Arc<Self>) -> StorageResult<()> {
// Ignore any error from either one-shot channel or join handler here.
// Because on runtime teardown, compactor and vacuum tasks might
// be dropped before this.

let mut handler = self.compactor_handler.lock().await;
info!("shutting down compactor");
handler.0.take().unwrap().send(()).ok();
handler.1.take().unwrap().await.ok();
handler.0.take().unwrap().send(()).unwrap();
handler.1.take().unwrap().await.unwrap();

let mut handler = self.vacuum_handler.lock().await;
info!("shutting down vacuum");
handler.0.take().unwrap().send(()).ok();
handler.1.take().unwrap().await.ok();
handler.0.take().unwrap().send(()).unwrap();
handler.1.take().unwrap().await.unwrap();

Ok(())
}
Expand Down

0 comments on commit 347f764

Please sign in to comment.