summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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 cbeb45a75..02349fd52 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 c2d18cc1d..df94550b3 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