From fbfa107cca831cf53bf3acea88cce723c32de136 Mon Sep 17 00:00:00 2001 From: Tarek Date: Wed, 12 Jun 2024 15:19:50 +0300 Subject: [PATCH] fix(fs-storage): drop the file handle in write_fs() Signed-off-by: Tarek --- fs-storage/src/file_storage.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fs-storage/src/file_storage.rs b/fs-storage/src/file_storage.rs index 276c808c..32daf013 100644 --- a/fs-storage/src/file_storage.rs +++ b/fs-storage/src/file_storage.rs @@ -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 {