mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-08-29 16:31:29 +00:00
call fsync before rename
This commit is contained in:
parent
5c73bc5bc7
commit
7b27f01e07
1 changed files with 2 additions and 0 deletions
|
@ -119,6 +119,8 @@ class WalletStorage(object):
|
||||||
s = json.dumps(self.data, indent=4, sort_keys=True)
|
s = json.dumps(self.data, indent=4, sort_keys=True)
|
||||||
with open(temp_path, "w") as f:
|
with open(temp_path, "w") as f:
|
||||||
f.write(s)
|
f.write(s)
|
||||||
|
f.flush()
|
||||||
|
os.fsync(f.fileno())
|
||||||
# perform atomic write on POSIX systems
|
# perform atomic write on POSIX systems
|
||||||
try:
|
try:
|
||||||
os.rename(temp_path, self.path)
|
os.rename(temp_path, self.path)
|
||||||
|
|
Loading…
Add table
Reference in a new issue