Browse Source

Fix hangup during scheduled restart.

tags/0.6.0
ShyPike 14 years ago
parent
commit
202089e829
  1. 10
      SABnzbd.py
  2. 11
      sabnzbd/__init__.py

10
SABnzbd.py

@ -1431,9 +1431,13 @@ def main():
### 3 sec polling tasks
# Check for auto-restart request
if cherrypy.engine.execv:
scheduler.stop()
sabnzbd.halt()
cherrypy.engine.exit()
if sabnzbd.SCHED_RESTART:
scheduler.abort()
sabnzbd.halt()
else:
scheduler.stop()
sabnzbd.halt()
cherrypy.engine.exit()
sabnzbd.SABSTOP = True
if sabnzbd.downloader.Downloader.do.paused:
re_argv.append('-p')

11
sabnzbd/__init__.py

@ -124,6 +124,7 @@ RESTART_REQ = False
OSX_ICON = 1
PAUSED_ALL = False
OLD_QUEUE = False
SCHED_RESTART = False # Set when restarted through scheduler
__INITIALIZED__ = False
__SHUTTING_DOWN__ = False
@ -643,11 +644,11 @@ def shutdown_program():
def restart_program():
""" Restart program (used by scheduler) """
logging.info("Performing sabnzbd restart")
sabnzbd.halt()
while __INITIALIZED__:
time.sleep(1.0)
cherrypy.engine.restart()
global SCHED_RESTART
logging.info("Scheduled restart request")
# Just set the stop flag, because stopping CherryPy from
# the scheduler is not reliable
cherrypy.engine.execv = SCHED_RESTART = True
def change_queue_complete_action(action, new=True):

Loading…
Cancel
Save