INNER CODE UNIT · Rust
drop
spacejam/sled · src/lib.rs:360
fn drop(&mut self) {
let (tx, rx) = std::sync::mpsc::channel();
log::debug!("sending shutdown signal to flusher");
if self.shutdown_sender.lock().unwrap().send(tx).is_ok() {
if let Err(e) = rx.recv() {
log::error!("failed to shut down flusher thread: {:?}", e);
} else {
log::debug!("flush thread successfully terminated");
}
} else {
log::debug!(
"failed to shut down flusher, manually flushing ObjectCache"
);
let cache = self.cache.lock().unwrap();
if let Err(e) = cache.flush() {
log::error!(
"Db flusher encountered error while flushing: {:?}",
e