1
0
mirror of https://github.com/moparisthebest/SickRage synced 2024-12-13 19:42:20 -05:00

Merge remote-tracking branch 'origin/dev'

This commit is contained in:
echel0n 2014-06-16 16:41:28 -07:00
commit 4c5dec7073
3 changed files with 17 additions and 10 deletions

View File

@ -387,17 +387,10 @@ def main():
# init startup tasks # init startup tasks
io_loop.add_timeout(datetime.timedelta(seconds=5), startup) 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. # autoreload.
if sickbeard.AUTO_UPDATE: if sickbeard.AUTO_UPDATE:
tornado.autoreload.start(io_loop) tornado.autoreload.start(io_loop)
tornado.autoreload.add_reload_hook(autoreload_shutdown) tornado.autoreload.add_reload_hook(sickbeard.autoreload_shutdown)
# start IOLoop. # start IOLoop.
io_loop.start() io_loop.start()

View File

@ -1820,3 +1820,11 @@ def getEpList(epIDs, showid=None):
epList.append(curEpObj) epList.append(curEpObj)
return epList 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())

View File

@ -63,6 +63,7 @@ from lib.dateutil import tz
from lib.unrar2 import RarFile from lib.unrar2 import RarFile
from lib import subliminal from lib import subliminal
import tornado
try: try:
import json import json
@ -77,8 +78,9 @@ except ImportError:
from lib import adba from lib import adba
from Cheetah.Template import Template from Cheetah.Template import Template
from tornado import gen from tornado import gen, autoreload
from tornado.web import RequestHandler, HTTPError, asynchronous, authenticated from tornado.web import RequestHandler, HTTPError, asynchronous, authenticated
from tornado.ioloop import IOLoop
# def _handle_reverse_proxy(): # def _handle_reverse_proxy():
# if sickbeard.HANDLE_REVERSE_PROXY: # if sickbeard.HANDLE_REVERSE_PROXY:
@ -3300,11 +3302,15 @@ class Home(IndexHandler):
if str(pid) != str(sickbeard.PID): if str(pid) != str(sickbeard.PID):
self.redirect("/home/") self.redirect("/home/")
# auto-reload
tornado.autoreload.start(IOLoop.current())
tornado.autoreload.add_reload_hook(sickbeard.autoreload_shutdown)
updated = sickbeard.versionCheckScheduler.action.update() # @UndefinedVariable updated = sickbeard.versionCheckScheduler.action.update() # @UndefinedVariable
if updated: if updated:
# do a hard restart # 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") t = PageTemplate(file="restart_bare.tmpl")
return _munge(t) return _munge(t)
else: else: