Browse Source

Remove web_watchdog

We shouldn't need this
pull/745/head
Safihre 9 years ago
parent
commit
a7697d4479
  1. 1
      README.mkd
  2. 16
      SABnzbd.py
  3. 1
      sabnzbd/cfg.py
  4. 7
      sabnzbd/interface.py
  5. 11
      sabnzbd/newsunpack.py

1
README.mkd

@ -26,6 +26,7 @@ Release Notes - SABnzbd 1.2.0
- Dropped dependency on PyOpenSSL, now only requires cryptography package
- Update 7zip to 16.04 and UnRar to 5.40 for Windows/macOS
- Python post/pre/notification-scripts require execute permissions
- Removed web_watchdog
## Bug fixes
- Re-use IP-address for new connections when a server has open connections

16
SABnzbd.py

@ -690,13 +690,13 @@ def attach_server(host, port, cert=None, key=None, chain=None):
http_server.subscribe()
def is_sabnzbd_running(url, timeout=None):
def is_sabnzbd_running(url):
""" Return True when there's already a SABnzbd instance running. """
try:
url = '%s&mode=version' % (url)
# Do this without certificate verification, few installations will have that
prev = sabnzbd.set_https_verification(False)
ver = sabnzbd.newsunpack.get_from_url(url, timeout=timeout)
ver = sabnzbd.newsunpack.get_from_url(url)
sabnzbd.set_https_verification(prev)
return bool(ver and re.search(r'\d+\.\d+\.', ver))
except:
@ -1573,7 +1573,7 @@ def main():
add_local(f)
# Have to keep this running, otherwise logging will terminate
timer = timer5 = 0
timer = 0
while not sabnzbd.SABSTOP:
if sabnzbd.LAST_WARNING:
msg = sabnzbd.LAST_WARNING
@ -1621,16 +1621,6 @@ def main():
# Notify guardian
if sabnzbd.WIN_SERVICE and mail:
mail.send('active')
if timer5 > 9:
# 5 minute polling tasks
timer5 = 0
if sabnzbd.cfg.web_watchdog() and not is_sabnzbd_running('%s/api?tickleme=1' % sabnzbd.BROWSER_URL, 120):
autorestarted = True
cherrypy.engine.execv = True
else:
timer5 += 1
else:
timer += 1

1
sabnzbd/cfg.py

@ -401,7 +401,6 @@ wait_ext_drive = OptionNumber('misc', 'wait_ext_drive', 5, 1, 60)
queue_limit = OptionNumber('misc', 'queue_limit', 20, 0)
history_limit = OptionNumber('misc', 'history_limit', 10, 0)
show_sysload = OptionNumber('misc', 'show_sysload', 2, 0, 2)
web_watchdog = OptionBool('misc', 'web_watchdog', False)
enable_bonjour = OptionBool('misc', 'enable_bonjour', True)
allow_duplicate_files = OptionBool('misc', 'allow_duplicate_files', False)
warn_dupl_jobs = OptionBool('misc', 'warn_dupl_jobs', True)

7
sabnzbd/interface.py

@ -518,7 +518,6 @@ class MainPage(object):
@cherrypy.expose
def api(self, **kwargs):
""" Handler for API over http, with explicit authentication parameters """
if not kwargs.get('tickleme') or not cfg.web_watchdog():
if cfg.api_logging():
logging.debug('API-call from %s [%s] %s', cherrypy.request.remote.ip,
cherrypy.request.headers.get('User-Agent', '??'), kwargs)
@ -1501,9 +1500,9 @@ SPECIAL_BOOL_LIST = \
'prospective_par_download', 'never_repair', 'allow_streaming', 'ignore_unrar_dates',
'osx_menu', 'osx_speed', 'win_menu', 'use_pickle', 'allow_incomplete_nzb',
'rss_filenames', 'ipv6_hosting', 'keep_awake', 'empty_postproc', 'html_login',
'web_watchdog', 'wait_for_dfolder', 'warn_empty_nzb', 'enable_bonjour',
'allow_duplicate_files', 'warn_dupl_jobs', 'backup_for_duplicates', 'enable_par_cleanup',
'api_logging', 'fixed_ports'
'wait_for_dfolder', 'warn_empty_nzb', 'enable_bonjour','allow_duplicate_files',
'warn_dupl_jobs', 'backup_for_duplicates', 'enable_par_cleanup', 'api_logging',
'fixed_ports'
)
SPECIAL_VALUE_LIST = \
('size_limit', 'folder_max_length', 'fsys_type', 'movie_rename_limit', 'nomedia_marker',

11
sabnzbd/newsunpack.py

@ -1881,20 +1881,15 @@ def list2cmdline(lst):
return ' '.join(nlst)
def get_from_url(url, timeout=None):
def get_from_url(url):
""" Retrieve URL and return content
`timeout` sets non-standard timeout
"""
import urllib2
try:
if timeout:
s = urllib2.urlopen(url, timeout=timeout)
else:
s = urllib2.urlopen(url)
output = s.read()
return urllib2.urlopen(url).read()
except:
output = None
return output
return None
def is_sevenfile(path):

Loading…
Cancel
Save