mirror of
https://github.com/markqvist/Reticulum
synced 2026-11-27 23:00:28 +00:00
Ensure non-corrupting stats writes
This commit is contained in:
1 parent
cc90ac2853
commit
b30d272ee6
1 file changed
+3
-1
@@ -1294,7 +1294,9 @@ class ReticulumGitNode():
|
||||
def __persist_stats(self):
|
||||
with self.stats_lock:
|
||||
try:
|
||||
with open(self.statspath, "wb") as fh: fh.write(mp.packb(self.stats))
|
||||
tmp_path = self.statspath+".tmp"
|
||||
with open(tmp_path, "wb") as fh: fh.write(mp.packb(self.stats))
|
||||
os.rename(tmp_path, self.statspath)
|
||||
except Exception as e: RNS.log(f"Could not write stats file to {self.statspath}: {e}", RNS.LOG_ERROR)
|
||||
|
||||
def __apply_config(self):
|
||||
|
||||
Reference in new issue
Block a user