Skip to content

Commit

Permalink
Giving up on elegant solutions to prevent stalling, just use a check
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Safihre committed Sep 5, 2017
1 parent 0aac9a5 commit 8ec53a3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
11 changes: 11 additions & 0 deletions sabnzbd/nzbqueue.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
6 changes: 0 additions & 6 deletions sabnzbd/nzbstuff.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down

0 comments on commit 8ec53a3

Please sign in to comment.