Pedro Algarvio : On some "race" conditions, the torrent is removed before it's status could be retrieved. Return an empty status.

0 views
Skip to first unread message

g...@deluge-torrent.org

unread,
Dec 9, 2012, 5:31:37 PM12/9/12
to deluge...@googlegroups.com
Module: deluge
Branch: 1.3-stable
Commit: b5ea33e5066629e2b22b937920d8bf2da49bcfd8

Author: Pedro Algarvio <pe...@algarvio.me>
Date: Sun May 8 21:35:06 2011 +0100

On some "race" conditions, the torrent is removed before it's status could be retrieved. Return an empty status.

---

deluge/core/core.py | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/deluge/core/core.py b/deluge/core/core.py
index 42fa0f4..8a4d3f3 100644
--- a/deluge/core/core.py
+++ b/deluge/core/core.py
@@ -421,7 +421,11 @@ class Core(component.Component):
@export
def get_torrent_status(self, torrent_id, keys, diff=False):
# Build the status dictionary
- status = self.torrentmanager[torrent_id].get_status(keys, diff)
+ try:
+ status = self.torrentmanager[torrent_id].get_status(keys, diff)
+ except KeyError:
+ # Torrent was probaly removed meanwhile
+ return {}

# Get the leftover fields and ask the plugin manager to fill them
leftover_fields = list(set(keys) - set(status.keys()))

Reply all
Reply to author
Forward
0 new messages