Save resume data periodically

This commit is contained in:
Andrew Resch 2008-08-02 03:12:15 +00:00
parent 897ef1135d
commit da309c66c3
2 changed files with 7 additions and 0 deletions

View file

@ -1,6 +1,7 @@
Deluge 0.9.05 - "1.0.0_RC5" (In Development)
Core:
* Fix deluged running with ssh X forwarding by removing the Gnome lib import
* Save resume data periodically to help prevent data loss
Plugins:
* Improve the Blocklist plugin preferences page.

View file

@ -162,6 +162,7 @@ class TorrentManager(component.Component):
# Save the state every 5 minutes
self.save_state_timer = gobject.timeout_add(300000, self.save_state)
self.save_resume_data_timer = gobject.timeout_add(290000, self.save_resume_data)
def stop(self):
# Save state on shutdown
@ -552,6 +553,11 @@ class TorrentManager(component.Component):
# We return True so that the timer thread will continue
return True
def save_resume_data(self):
"""Saves resume data for all the torrents"""
for torrent in self.torrents.values():
torrent.write_fastresume()
def queue_top(self, torrent_id):
"""Queue torrent to top"""
if self.torrents[torrent_id].get_queue_position() == 0: