Save resume data periodically

This commit is contained in:
Andrew Resch 2008-08-02 03:12:15 +00:00
parent 1c94623569
commit 189e01f424
1 changed files with 7 additions and 1 deletions

View File

@ -162,6 +162,7 @@ class TorrentManager(component.Component):
# Save the state every 5 minutes # Save the state every 5 minutes
self.save_state_timer = gobject.timeout_add(300000, self.save_state) 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): def stop(self):
# Save state on shutdown # Save state on shutdown
@ -552,6 +553,11 @@ class TorrentManager(component.Component):
# We return True so that the timer thread will continue # We return True so that the timer thread will continue
return True 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): def queue_top(self, torrent_id):
"""Queue torrent to top""" """Queue torrent to top"""
if self.torrents[torrent_id].get_queue_position() == 0: if self.torrents[torrent_id].get_queue_position() == 0: