From 764f7df6a788e5be14a408385c233a29928896fe Mon Sep 17 00:00:00 2001 From: Safihre Date: Sun, 3 Jan 2021 13:14:23 +0100 Subject: [PATCH] Limit the number of TryList resets This might cause problems, but it's worth a try. It seems we resetted the trylists so often, this would cause a lot of extra CPU cycles to try all articles again. --- sabnzbd/downloader.py | 9 +++++---- sabnzbd/nzbqueue.py | 5 ----- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/sabnzbd/downloader.py b/sabnzbd/downloader.py index 8db52e6..f7543d1 100644 --- a/sabnzbd/downloader.py +++ b/sabnzbd/downloader.py @@ -395,11 +395,13 @@ class Downloader(Thread): # Remove all connections to server for nw in server.idle_threads + server.busy_threads: self.__reset_nw(nw, "forcing disconnect", warn=False, wait=False, send_quit=False) + # Let the other servers try the articles of this server again + if nw.article: + sabnzbd.NzbQueue.reset_try_lists(nw.article) + # Make sure server address resolution is refreshed server.info = None - sabnzbd.NzbQueue.reset_all_try_lists() - def decode(self, article, raw_data: Optional[List[bytes]]): """Decode article and check the status of the decoder and the assembler @@ -480,7 +482,6 @@ class Downloader(Thread): if newid: self.init_server(None, newid) self.__restart -= 1 - sabnzbd.NzbQueue.reset_all_try_lists() # Have to leave this loop, because we removed element break else: @@ -723,7 +724,7 @@ class Downloader(Thread): server.active = False if penalty and (block or server.optional): self.plan_server(server, penalty) - sabnzbd.NzbQueue.reset_all_try_lists() + sabnzbd.NzbQueue.reset_try_lists(article) self.__reset_nw(nw, None, warn=False, send_quit=True) continue except: diff --git a/sabnzbd/nzbqueue.py b/sabnzbd/nzbqueue.py index ef00b62..a1b9136 100644 --- a/sabnzbd/nzbqueue.py +++ b/sabnzbd/nzbqueue.py @@ -480,7 +480,6 @@ class NzbQueue: if nzo_id in self.__nzo_table: nzo = self.__nzo_table[nzo_id] nzo.resume() - nzo.reset_all_try_lists() logging.info("Resumed nzo: %s", nzo_id) handled.append(nzo_id) return handled @@ -694,10 +693,6 @@ class NzbQueue: article.nzf.reset_try_list() article.nzf.nzo.reset_try_list() - def reset_all_try_lists(self): - for nzo in self.__nzo_list: - nzo.reset_all_try_lists() - def has_forced_items(self): """Check if the queue contains any Forced Priority items to download while paused