From 5057e2caab9957e8119e3e1a4a0ce83126caef29 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Wed, 22 May 2013 23:15:55 +0100 Subject: [PATCH] Fix #2303 : Torrent state not updated until after emitting TorrentFinishedEvent --- deluge/core/torrentmanager.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index 6254ffe59..8aa2503f7 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -896,10 +896,12 @@ class TorrentManager(component.Component): if torrent.options["download_location"] != move_path: torrent.move_storage(move_path) - component.get("EventManager").emit(TorrentFinishedEvent(torrent_id)) - - torrent.is_finished = True torrent.update_state() + if not torrent.is_finished and total_download: + torrent.is_finished = True + component.get("EventManager").emit(TorrentFinishedEvent(torrent_id)) + else: + torrent.is_finished = True # Torrent is no longer part of the queue try: