From d3589ef277c929c8ca94804d3ae36756703393be Mon Sep 17 00:00:00 2001 From: Tarek Date: Fri, 14 Jun 2024 16:36:00 +0300 Subject: [PATCH] no delay needed and force timestamp write Signed-off-by: Tarek --- fs-storage/src/file_storage.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/fs-storage/src/file_storage.rs b/fs-storage/src/file_storage.rs index 276c808c..c98f825d 100644 --- a/fs-storage/src/file_storage.rs +++ b/fs-storage/src/file_storage.rs @@ -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 {