Skip to content

Commit

Permalink
Try to fsync message log on drop
Browse files Browse the repository at this point in the history
  • Loading branch information
kim committed Dec 4, 2023
1 parent 4ef1bd5 commit d303451
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions crates/core/src/db/message_log.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,14 @@ impl std::fmt::Debug for MessageLog {
}
}

impl Drop for MessageLog {
fn drop(&mut self) {
if let Err(e) = self.sync_all() {
log::warn!("Unable to fsync on drop: {e}");
}
}
}

// TODO: do we build the concept of batches into the message log?
impl MessageLog {
#[tracing::instrument(skip(path))]
Expand Down

0 comments on commit d303451

Please sign in to comment.