Skip to content

Commit

Permalink
no delay needed and force timestamp write
Browse files Browse the repository at this point in the history
Signed-off-by: Tarek <[email protected]>
  • Loading branch information
tareknaser committed Jun 14, 2024
1 parent 3831efc commit d3589ef
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions fs-storage/src/file_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,10 @@ where
let mut file = File::create(&self.path)?;
file.write_all(serde_json::to_string_pretty(&self.data)?.as_bytes())?;
file.flush()?;
// We need to manually set the modified time of the file
let new_timestamp = SystemTime::now();
file.set_modified(new_timestamp)?;
file.sync_all()?;

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

0 comments on commit d3589ef

Please sign in to comment.