summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Garland <johnnybg+deluge@gmail.com>2012-04-12 23:21:08 +1000
committerJohn Garland <johnnybg+deluge@gmail.com>2012-04-12 23:52:50 +1000
commit914413c88fb17ef67808dd21784cd9f4344ed3e3 (patch)
tree7d1a3fbe02006b4fdbd51cb51de62262e9cb577a
parent438dff177c2349ba4502df947d5c1130bcd501a5 (diff)
downloaddeluge-914413c88fb17ef67808dd21784cd9f4344ed3e3.zip
deluge-914413c88fb17ef67808dd21784cd9f4344ed3e3.tar.gz
deluge-914413c88fb17ef67808dd21784cd9f4344ed3e3.tar.bz2
Catch & log KeyError when removing a torrent from the queued torrents set
This seems to happen due to libtorrent firing the torrent finished event twice.
-rw-r--r--ChangeLog4
-rw-r--r--deluge/core/torrentmanager.py11
2 files changed, 13 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index cbeb45a..02349fd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+=== Deluge 1.3.6 (In Development) ===
+==== Core ====
+ * Catch & log KeyError when removing a torrent from the queued torrents set
+
=== Deluge 1.3.5 (09 April 2012) ===
==== Core ====
* Fix not properly detecting when torrent is at end of queue
diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py
index c2d18cc..df94550 100644
--- a/deluge/core/torrentmanager.py
+++ b/deluge/core/torrentmanager.py
@@ -590,7 +590,10 @@ class TorrentManager(component.Component):
# Remove from set if it wasn't finished
if not self.torrents[torrent_id].is_finished:
- self.queued_torrents.remove(torrent_id)
+ try:
+ self.queued_torrents.remove(torrent_id)
+ except KeyError:
+ log.debug("%s isn't in queued torrents set?", torrent_id)
# Remove the torrent from deluge's session
try:
@@ -893,7 +896,11 @@ class TorrentManager(component.Component):
torrent.update_state()
# Torrent is no longer part of the queue
- self.queued_torrents.remove(torrent_id)
+ try:
+ self.queued_torrents.remove(torrent_id)
+ except KeyError:
+ # Sometimes libtorrent fires a TorrentFinishedEvent twice
+ log.debug("%s isn't in queued torrents set?", torrent_id)
# Only save resume data if it was actually downloaded something. Helps
# on startup with big queues with lots of seeding torrents. Libtorrent