Commit 827fac18 authored by echel0n's avatar echel0n
Browse files

fixed amqp bug that caused a restart loop when updating ssl server cert/key

added restart method to core class
parent cbb29092
......@@ -738,6 +738,9 @@ class Core(object):
self.started = False
def restart(self):
self.shutdown(restart=True)
def shutdown_trigger(self):
if not self.started:
IOLoop.current().stop()
......@@ -100,7 +100,7 @@ class VersionUpdater(object):
if self.update():
sickrage.app.log.info("Update was successful!")
sickrage.app.alerts.message(_('Updater'), _('Update was successful'))
sickrage.app.shutdown(restart=True)
sickrage.app.restart()
else:
sickrage.app.log.info("Update failed!")
sickrage.app.alerts.error(_('Updater'), _('Update failed!'))
......
......@@ -31,7 +31,7 @@ from cryptography.hazmat.backends import default_backend
from cryptography.x509 import ExtensionNotFound
from mako.lookup import TemplateLookup
from tornado.httpserver import HTTPServer
from tornado.ioloop import PeriodicCallback
from tornado.ioloop import PeriodicCallback, IOLoop
from tornado.web import Application, RedirectHandler, StaticFileHandler
import sickrage
......@@ -529,10 +529,11 @@ class WebServer(object):
with open(sickrage.app.https_key_file, 'w') as key_out:
key_out.write(resp['private_key'])
sickrage.app.log.info("Loaded SSL certificate successfully")
sickrage.app.log.info("Loaded SSL certificate successfully, restarting server in 1 minute")
if self.server:
sickrage.app.shutdown(restart=True)
# restart after 1 minute
IOLoop.current().add_timeout(datetime.timedelta(minutes=1), sickrage.app.restart)
return True
......
......@@ -1489,7 +1489,7 @@ class CMD_SiCKRAGERestart(ApiV1Handler):
def run(self):
""" Restart SiCKRAGE """
sickrage.app.shutdown(restart=True)
sickrage.app.restart()
return _responds(RESULT_SUCCESS, msg="SiCKRAGE is restarting...")
......
......@@ -700,12 +700,11 @@ class RestartHandler(BaseHandler):
self.current_user = None
sickrage.app.scheduler.add_job(
sickrage.app.shutdown,
sickrage.app.restart,
DateTrigger(
run_date=datetime.datetime.utcnow() + datetime.timedelta(seconds=5),
timezone='utc'
),
kwargs={'restart': True}
)
)
return self.render('home/restart.mako',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment