From 8ec53a3bce8ef37f3533fb05718d23f15d8580a0 Mon Sep 17 00:00:00 2001 From: Safihre Date: Tue, 5 Sep 2017 16:05:19 +0200 Subject: [PATCH] Giving up on elegant solutions to prevent stalling, just use a check This stupid nightmare still wasn't fixed. The proper solution creates slowdown on many systems because it's not efficient enough. Instead just do a check every 90 seconds if there's stalled stuff. --- sabnzbd/nzbqueue.py | 11 +++++++++++ sabnzbd/nzbstuff.py | 6 ------ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/sabnzbd/nzbqueue.py b/sabnzbd/nzbqueue.py index 935376582a1..ad9e165d87c 100644 --- a/sabnzbd/nzbqueue.py +++ b/sabnzbd/nzbqueue.py @@ -864,6 +864,17 @@ def stop_idle_jobs(self): if not nzo.futuretype and not nzo.files and nzo.status not in (Status.PAUSED, Status.GRABBING): empty.append(nzo) + # Stall prevention by checking if all servers are in the trylist + # This is a CPU-cheaper alternative to prevent stalling + if len(nzo.try_list) == sabnzbd.downloader.Downloader.do.server_nr: + # Maybe the NZF's need a reset too? + for nzf in nzo.files: + if len(nzf.try_list) == sabnzbd.downloader.Downloader.do.server_nr: + # We do not want to reset all article trylists, they are good + nzf.reset_try_list() + # Reset main trylist, minimal performance impact + nzo.reset_try_list() + for nzo in empty: self.end_job(nzo) diff --git a/sabnzbd/nzbstuff.py b/sabnzbd/nzbstuff.py index bb22618d270..ca125171629 100644 --- a/sabnzbd/nzbstuff.py +++ b/sabnzbd/nzbstuff.py @@ -301,12 +301,6 @@ def remove_article(self, article, found): if found: self.bytes_left -= article.bytes - # The parent trylist is filled to the top, maybe too soon - # This is a CPU-cheaper alternative to prevent stalling - if len(self.nzo.try_list) == sabnzbd.downloader.Downloader.do.server_nr: - self.reset_try_list() - self.nzo.reset_try_list() - return (not self.articles) def set_par2(self, setname, vol, blocks):