fix(pref_storage): sync file operations to ensure valid config files
Before we may initiate a new write before the old one was done, so we
ended up with partially written (and as such invalid) config files
fixes
@@ -99,6 +99,8 @@ impl<T> Config<T> {
self.config = config_toml.clone();
+ config_file.sync_all()?;
+
Ok(self)
}
@@ -113,6 +115,8 @@ impl<T> Config<T> {
config_file.write_all(toml::to_string(&self.config)?.as_bytes())?;
+ config_file.sync_all()?;
+
Ok(())
}
}
