mirror of
https://github.com/SickGear/SickGear.git
synced 2024-12-22 10:43:38 +00:00
Add logging around the restart/shutdown event.
This commit is contained in:
parent
c076c495ee
commit
99aa339bbf
4 changed files with 18 additions and 0 deletions
|
@ -5,6 +5,10 @@
|
|||
* Change requirements for pure py3
|
||||
* Change codebase cleanups
|
||||
|
||||
[develop changelog]
|
||||
|
||||
* Add logging around the restart/shutdown event
|
||||
|
||||
|
||||
### 3.27.11 (2023-03-06 23:40:00 UTC)
|
||||
|
||||
|
|
|
@ -769,6 +769,7 @@ class SickGear(object):
|
|||
return False
|
||||
|
||||
def shutdown(self, ev_type):
|
||||
logger.debug(f'Shutdown ev_type:{ev_type}, sickgear.started:{sickgear.started}')
|
||||
if sickgear.started:
|
||||
# stop all tasks
|
||||
sickgear.halt()
|
||||
|
|
|
@ -1747,6 +1747,7 @@ def restart(soft=True, update_pkg=None):
|
|||
if update_pkg:
|
||||
MY_ARGS.append('--update-pkg')
|
||||
|
||||
logger.log(u'Trigger event restart')
|
||||
events.put(events.SystemEvent.RESTART)
|
||||
|
||||
else:
|
||||
|
@ -1770,8 +1771,10 @@ def sig_handler(signum=None, _=None):
|
|||
def halt():
|
||||
global __INITIALIZED__, started
|
||||
|
||||
logger.debug('Check INIT_LOCK on halt')
|
||||
with INIT_LOCK:
|
||||
|
||||
logger.debug(f'Check __INITIALIZED__ on halt: {__INITIALIZED__}')
|
||||
if __INITIALIZED__:
|
||||
|
||||
logger.log('Exiting threads')
|
||||
|
|
|
@ -32,7 +32,17 @@ class Events(threading.Thread):
|
|||
try:
|
||||
# get event type
|
||||
etype = self.queue.get(True, 1)
|
||||
except moves.queue.Empty:
|
||||
etype = 'Empty'
|
||||
except(BaseException, Exception):
|
||||
etype = None
|
||||
if etype in (self.SystemEvent.RESTART, self.SystemEvent.SHUTDOWN, None, 'Empty'):
|
||||
if etype in ('Empty',):
|
||||
continue
|
||||
from sickgear import logger
|
||||
logger.debug(f'Callback {self.callback.__name__}(event type:{etype})')
|
||||
|
||||
try:
|
||||
# perform callback if we got an event type
|
||||
self.callback(etype)
|
||||
|
||||
|
|
Loading…
Reference in a new issue