From 189e01f424b5f19833168308df3e54c957bfe640 Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Sat, 2 Aug 2008 03:12:15 +0000 Subject: [PATCH] Save resume data periodically --- deluge/core/torrentmanager.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index e1392524d..d85c0bce9 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -162,7 +162,8 @@ 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 self.save_state() @@ -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: