Browse Source

Limited article retries for servers.

This will prevent most deadlock situations, if configured right.
pull/7/head
ShyPike 14 years ago
parent
commit
6571ba90ca
  1. 7
      interfaces/Classic/templates/config_switches.tmpl
  2. 17
      interfaces/Plush/templates/config_switches.tmpl
  3. 10
      interfaces/smpl/templates/config_switches.tmpl
  4. 740
      po/main/SABnzbd.pot
  5. 2
      sabnzbd/cfg.py
  6. 1
      sabnzbd/decoder.py
  7. 24
      sabnzbd/downloader.py
  8. 4
      sabnzbd/interface.py
  9. 4
      sabnzbd/nzbstuff.py
  10. 4
      sabnzbd/skintext.py

7
interfaces/Classic/templates/config_switches.tmpl

@ -100,6 +100,13 @@
</fieldset>
<fieldset class="EntryFieldSet">
<legend>$T('otherSwitches')</legend>
<label><strong>$T('opt-max_art_tries')</strong></label><br>
$T('explain-max_art_tries')<br>
<input type="text" size=5" name="max_art_tries" value="$max_art_tries" />
<br><br>
<label><input type="checkbox" name="max_opt_only" value="1" <!--#if $max_opt_only > 0 then "checked=1" else ""#--> /> <strong>$T('opt-max_opt_only')</strong></label><br>
$T('explain-max_opt_only')<br>
<br>
<label><input type="checkbox" name="auto_disconnect" value="1" <!--#if $auto_disconnect > 0 then "checked=1" else ""#--> /> <strong>$T('opt-auto_disconnect')</strong></label><br>
$T('explain-auto_disconnect')<br>
<br>

17
interfaces/Plush/templates/config_switches.tmpl

@ -44,6 +44,23 @@
</div>
<fieldset class="component-group-list">
<div class="field-pair">
<label class="nocheck clearfix" for="max_art_tries">
<span class="component-title">$T('opt-max_art_tries')</span>
<input type="text" size="10" name="max_art_tries" id="max_art_tries" value="$max_art_tries" />
</label>
<label class="nocheck clearfix">
<span class="component-title">&nbsp;</span>
<span class="component-desc">$T('explain-max_art_tries')</span>
</label>
</div>
<div class="field-pair alt">
<input type="checkbox" name="max_opt_only" id="max_opt_only" value="1" <!--#if $max_opt_only > 0 then "checked=1" else ""#--> />
<label class="clearfix" for="max_opt_only">
<span class="component-title">$T('opt-max_opt_only')</span>
<span class="component-desc">$T('explain-max_opt_only')</span>
</label>
</div>
<div class="field-pair">
<input type="checkbox" name="auto_disconnect" id="auto_disconnect" value="1" <!--#if $auto_disconnect > 0 then "checked=1" else ""#--> />
<label class="clearfix" for="auto_disconnect">
<span class="component-title">$T('opt-auto_disconnect')</span>

10
interfaces/smpl/templates/config_switches.tmpl

@ -128,6 +128,16 @@
<hr />
<label><span class="label">$T('opt-max_art_tries'):</span>
<input type="text" size="5" name="max_art_tries" value="$max_art_tries" />
<span class="tips">$T('explain-max_art_tries')</span></label>
<br class="clear" />
<label><span class="label">$T('opt-max_opt_only'):</span>
<input class="radio" type="checkbox" name="max_opt_only" value="1" <!--#if $max_opt_only > 0 then 'checked="1"' else ""#--> />
<span class="tips">$T('explain-max_opt_only')</span></label>
<br class="clear" />
<label><span class="label">$T('opt-auto_disconnect'):</span>
<input class="radio" type="checkbox" name="auto_disconnect" value="1" <!--#if $auto_disconnect > 0 then 'checked="1"' else ""#--> />
<span class="tips">$T('explain-auto_disconnect')</span></label>

740
po/main/SABnzbd.pot

File diff suppressed because it is too large

2
sabnzbd/cfg.py

@ -211,6 +211,8 @@ api_key = OptionStr('misc', 'api_key', create_api_key())
nzb_key = OptionStr('misc', 'nzb_key', create_api_key())
disable_key = OptionBool('misc', 'disable_api_key', False)
api_warnings = OptionBool('misc', 'api_warnings', True)
max_art_tries = OptionNumber('misc', 'max_art_tries', 3, 2)
max_opt_only = OptionBool('misc', 'max_opt_only', True)
growl_server = OptionStr('growl', 'growl_server')
growl_password = OptionPassword('growl', 'growl_password')

1
sabnzbd/decoder.py

@ -181,6 +181,7 @@ class Decoder(Thread):
if new_server_found:
article.fetcher = None
article.tries = 0
## Allow all servers to iterate over this nzo and nzf again ##
NzbQueue.do.reset_try_lists(nzf, nzo)

24
sabnzbd/downloader.py

@ -283,6 +283,13 @@ class Downloader(Thread):
server.errormsg = T('Server %s will be ignored for %s minutes') % ('', _PENALTY_TIMEOUT)
logging.warning(Ta('Server %s will be ignored for %s minutes'), server.id, _PENALTY_TIMEOUT)
self.plan_server(server.id, _PENALTY_TIMEOUT)
# Remove all connections to server
for nw in server.idle_threads + server.busy_threads:
self.__reset_nw(nw, "forcing disconnect", warn=False, wait=False, quit=False)
# Make sure server address resolution is refreshed
server.info = None
NzbQueue.do.reset_all_try_lists()
@ -589,6 +596,7 @@ class Downloader(Thread):
self.__reset_nw(nw, msg, quit=True)
if done:
server.bad_cons = 0 # Succesful data, clear "bad" counter
if sabnzbd.LOG_ALL:
logging.debug('Thread %s@%s:%s: %s done', nw.thrdnum, server.host,
server.port, article.article)
@ -640,15 +648,19 @@ class Downloader(Thread):
if fileno and fileno in self.read_fds:
self.read_fds.pop(fileno)
# Remove this server from try_list
if article:
article.fetcher = None
if article.tries > cfg.max_art_tries() and (article.fetcher.optional or not cfg.max_opt_only()):
# Too many tries on this server, consider article missing
self.decoder.decode(article, None)
else:
# Remove this server from try_list
article.fetcher = None
nzf = article.nzf
nzo = nzf.nzo
nzf = article.nzf
nzo = nzf.nzo
## Allow all servers to iterate over each nzo/nzf again ##
NzbQueue.do.reset_try_lists(nzf, nzo)
## Allow all servers to iterate over each nzo/nzf again ##
NzbQueue.do.reset_try_lists(nzf, nzo)
if destroy:
nw.terminate(quit=quit)

4
sabnzbd/interface.py

@ -1129,8 +1129,8 @@ SWITCH_LIST = \
'safe_postproc', 'no_dupes', 'replace_spaces', 'replace_dots', 'replace_illegal', 'auto_browser',
'ignore_samples', 'pause_on_post_processing', 'quick_check', 'nice', 'ionice',
'ssl_type', 'pre_script', 'pause_on_pwrar', 'ampm', 'sfv_check', 'folder_rename',
'unpack_check', 'pre_check',
'quota_size', 'quota_day', 'quota_resume', 'quota_period'
'unpack_check', 'quota_size', 'quota_day', 'quota_resume', 'quota_period',
'pre_check', 'max_art_tries', 'max_opt_only'
)
#------------------------------------------------------------------------------

4
sabnzbd/nzbstuff.py

@ -79,6 +79,7 @@ class Article(TryList):
self.art_id = None
self.bytes = bytes
self.partnum = partnum
self.tries = 0 # Try count
self.nzf = nzf
def get_article(self, server):
@ -88,6 +89,8 @@ class Article(TryList):
if not self.fetcher and not self.server_in_try_list(server):
self.fetcher = server
self.tries += 1
if sabnzbd.LOG_ALL: logging.debug('Article-try = %s', self.tries)
return self
return None
@ -115,6 +118,7 @@ class Article(TryList):
TryList.__init__(self)
self.fetcher = None
self.allow_fill_server = False
self.tries = 0
def __repr__(self):
return "<Article: article=%s, bytes=%s, partnum=%s, art_id=%s>" % \

4
sabnzbd/skintext.py

@ -438,6 +438,10 @@ SKIN_TEXT = {
'explain-quota_period' : TT('Does the quota get reset each day, week or month?'),
'opt-pre_check' : TT('Check before download'),
'explain-pre_check' : TT('Try to predict successful completion before actual download (slower!)'),
'opt-max_art_tries' : TT('Maximum retries'),
'explain-max_art_tries' : TT('Maximum number of retries per server'),
'opt-max_opt_only' : TT('Only for optional servers'),
'explain-max_opt_only' : TT('Apply maximum retries only to optional servers'),
# Config->Server
'configServer' : TT('Server configuration'),

Loading…
Cancel
Save