flush DB changes on drop (#2795)
This commit is contained in:
parent
8e5c9ff162
commit
7bd37e3972
@ -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)]
|
#[cfg(test)]
|
||||||
mod tests {
|
mod tests {
|
||||||
use hash::*;
|
use hash::*;
|
||||||
|
Loading…
Reference in New Issue
Block a user