[Core] Fixed KeyError in sessionproxy after torrent delete
When several torrents are being removed from session, an exception was being raised in a callback function `on_status` with the `torrent_id` of one (or more) of the removed torrents. Now we will catch when the torrent does not exist anymore and print a debug log about it. Closes: https://dev.deluge-torrent.org/ticket/3498 Closes: https://github.com/deluge-torrent/deluge/pull/341
This commit is contained in:
parent
a954348567
commit
7fa0af3446
|
@ -145,11 +145,17 @@ class SessionProxy(component.Component):
|
|||
|
||||
def on_status(result, torrent_id):
|
||||
t = time()
|
||||
try:
|
||||
self.torrents[torrent_id][0] = t
|
||||
self.torrents[torrent_id][1].update(result)
|
||||
for key in keys_to_get:
|
||||
self.cache_times[torrent_id][key] = t
|
||||
return self.create_status_dict([torrent_id], keys)[torrent_id]
|
||||
except KeyError:
|
||||
log.debug(
|
||||
f'Status missing for torrent (removed?): {torrent_id}'
|
||||
)
|
||||
return {}
|
||||
|
||||
return d.addCallback(on_status, torrent_id)
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue