Rework restart methods
This commit is contained in:
1 parent
1c5f19a68a
commit
94064ac7da
7 files changed
+31
-19
No files matched your search
@@ -118,7 +118,7 @@ class Core(Plugin):
|
||||
|
||||
self.shutdown_started = True
|
||||
|
||||
fireEvent('app.do_shutdown')
|
||||
fireEvent('app.do_shutdown', restart = restart)
|
||||
log.debug('Every plugin got shutdown event')
|
||||
|
||||
loop = True
|
||||
@@ -143,9 +143,11 @@ class Core(Plugin):
|
||||
|
||||
log.debug('Safe to shutdown/restart')
|
||||
|
||||
loop = IOLoop.current()
|
||||
|
||||
try:
|
||||
if not IOLoop.current()._closing:
|
||||
IOLoop.current().stop()
|
||||
if not loop._closing:
|
||||
loop.stop()
|
||||
except RuntimeError:
|
||||
pass
|
||||
except:
|
||||
|
||||
@@ -33,9 +33,9 @@ class Scheduler(Plugin):
|
||||
except:
|
||||
pass
|
||||
|
||||
def doShutdown(self):
|
||||
def doShutdown(self, *args, **kwargs):
|
||||
self.stop()
|
||||
return super(Scheduler, self).doShutdown()
|
||||
return super(Scheduler, self).doShutdown(*args, **kwargs)
|
||||
|
||||
def stop(self):
|
||||
if self.started:
|
||||
|
||||
@@ -142,11 +142,11 @@ class Updater(Plugin):
|
||||
'success': success
|
||||
}
|
||||
|
||||
def doShutdown(self):
|
||||
def doShutdown(self, *args, **kwargs):
|
||||
if not Env.get('dev'):
|
||||
removePyc(Env.get('app_dir'), show_logs = False)
|
||||
|
||||
return super(Updater, self).doShutdown()
|
||||
return super(Updater, self).doShutdown(*args, **kwargs)
|
||||
|
||||
|
||||
class BaseUpdater(Plugin):
|
||||
|
||||
@@ -263,7 +263,7 @@ class Plugin(object):
|
||||
def afterCall(self, handler):
|
||||
self.isRunning('%s.%s' % (self.getName(), handler.__name__), False)
|
||||
|
||||
def doShutdown(self):
|
||||
def doShutdown(self, *args, **kwargs):
|
||||
self.shuttingDown(True)
|
||||
return True
|
||||
|
||||
|
||||
Reference in new issue
Block a user