Skip to content

Commit

Permalink
fix(fs-storage): drop the file handle in write_fs()
Browse files Browse the repository at this point in the history
Signed-off-by: Tarek <[email protected]>
  • Loading branch information
tareknaser committed Jun 12, 2024
1 parent 3831efc commit fbfa107
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions fs-storage/src/file_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ where
let mut file = File::create(&self.path)?;
file.write_all(serde_json::to_string_pretty(&self.data)?.as_bytes())?;
file.flush()?;
// Drop the file handle to ensure metadata is updated
drop(file);

let new_timestamp = fs::metadata(&self.path)?.modified()?;
if new_timestamp == self.modified {
Expand Down

0 comments on commit fbfa107

Please sign in to comment.