diff --git a/util/src/kvdb.rs b/util/src/kvdb.rs index 7d6ea399c..4c5b7a3d0 100644 --- a/util/src/kvdb.rs +++ b/util/src/kvdb.rs @@ -595,6 +595,13 @@ impl Database { } } +impl Drop for Database { + fn drop(&mut self) { + // write all buffered changes if we can. + let _ = self.flush(); + } +} + #[cfg(test)] mod tests { use hash::*;