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()))

-- 
You received this message because you are subscribed to the Google Groups 
"deluge-commit" group.
To post to this group, send email to deluge-commit@googlegroups.com.
To unsubscribe from this group, send email to 
deluge-commit+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/deluge-commit?hl=en.

Reply via email to