mirror of
https://git.deluge-torrent.org/deluge
synced 2025-04-20 19:44:52 +00:00
Make sure config files, resume data and state are fsync'd when saved. This should help prevent data
losses on crashes/improper shutdowns.
This commit is contained in:
parent
8f4583bc23
commit
3cab036b70
1 changed files with 2 additions and 0 deletions
|
@ -541,6 +541,8 @@ class TorrentManager(component.Component):
|
|||
os.path.join(self.config["state_location"], "torrents.state.new"),
|
||||
"wb")
|
||||
cPickle.dump(state, state_file)
|
||||
state_file.flush()
|
||||
os.fsync(state_file.fileno())
|
||||
state_file.close()
|
||||
except IOError:
|
||||
log.warning("Unable to save state file.")
|
||||
|
|
Loading…
Add table
Reference in a new issue