mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-01 00:43:37 +00:00
Fixed forced updates to wait for auto-reload instead of performing a restart.
This commit is contained in:
parent
dccf371ebd
commit
2ac1c5fdd5
3 changed files with 17 additions and 10 deletions
|
@ -387,17 +387,10 @@ def main():
|
|||
# init startup tasks
|
||||
io_loop.add_timeout(datetime.timedelta(seconds=5), startup)
|
||||
|
||||
def autoreload_shutdown():
|
||||
logger.log('SickRage is now auto-reloading, please stand by ...')
|
||||
webserveInit.server.stop()
|
||||
sickbeard.halt()
|
||||
sickbeard.saveAll()
|
||||
sickbeard.cleanup_tornado_sockets(io_loop)
|
||||
|
||||
# autoreload.
|
||||
if sickbeard.AUTO_UPDATE:
|
||||
tornado.autoreload.start(io_loop)
|
||||
tornado.autoreload.add_reload_hook(autoreload_shutdown)
|
||||
tornado.autoreload.add_reload_hook(sickbeard.autoreload_shutdown)
|
||||
|
||||
# start IOLoop.
|
||||
io_loop.start()
|
||||
|
|
|
@ -1820,3 +1820,11 @@ def getEpList(epIDs, showid=None):
|
|||
epList.append(curEpObj)
|
||||
|
||||
return epList
|
||||
|
||||
|
||||
def autoreload_shutdown():
|
||||
logger.log('SickRage is now auto-reloading, please stand by ...')
|
||||
webserveInit.server.stop()
|
||||
halt()
|
||||
saveAll()
|
||||
cleanup_tornado_sockets(IOLoop.current())
|
||||
|
|
|
@ -63,6 +63,7 @@ from lib.dateutil import tz
|
|||
from lib.unrar2 import RarFile
|
||||
|
||||
from lib import subliminal
|
||||
import tornado
|
||||
|
||||
try:
|
||||
import json
|
||||
|
@ -77,8 +78,9 @@ except ImportError:
|
|||
from lib import adba
|
||||
|
||||
from Cheetah.Template import Template
|
||||
from tornado import gen
|
||||
from tornado import gen, autoreload
|
||||
from tornado.web import RequestHandler, HTTPError, asynchronous, authenticated
|
||||
from tornado.ioloop import IOLoop
|
||||
|
||||
# def _handle_reverse_proxy():
|
||||
# if sickbeard.HANDLE_REVERSE_PROXY:
|
||||
|
@ -3300,11 +3302,15 @@ class Home(IndexHandler):
|
|||
if str(pid) != str(sickbeard.PID):
|
||||
self.redirect("/home/")
|
||||
|
||||
# auto-reload
|
||||
tornado.autoreload.start(IOLoop.current())
|
||||
tornado.autoreload.add_reload_hook(sickbeard.autoreload_shutdown)
|
||||
|
||||
updated = sickbeard.versionCheckScheduler.action.update() # @UndefinedVariable
|
||||
|
||||
if updated:
|
||||
# do a hard restart
|
||||
threading.Timer(2, sickbeard.invoke_restart, [False]).start()
|
||||
#threading.Timer(2, sickbeard.invoke_restart, [False]).start()
|
||||
t = PageTemplate(file="restart_bare.tmpl")
|
||||
return _munge(t)
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue