Save resume data periodically
This commit is contained in:
parent
1c94623569
commit
189e01f424
|
@ -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:
|
||||||
|
|
Loading…
Reference in New Issue