From c668a59a82ae3a0f3fcdc4c400dc8858836e727b Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Tue, 30 Sep 2008 23:30:26 +0000 Subject: [PATCH] Fix resume saving on shutdown --- deluge/core/torrentmanager.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index 7e1c5ef65..42b803c51 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -193,12 +193,15 @@ class TorrentManager(component.Component): self.shutdown_torrent_pause_list.append(key) # We have to wait for all torrents to pause and write their resume data wait = True - while self.shutdown_torrent_pause_list or wait: - wait = False - for torrent in self.torrents.values(): - if torrent.waiting_on_resume_data: - wait = True - break + while wait: + if self.shutdown_torrent_pause_list: + wait = True + else: + wait = False + for torrent in self.torrents.values(): + if torrent.waiting_on_resume_data: + wait = True + break time.sleep(0.01) # Wait for all alerts