mirror of
https://github.com/SickGear/SickGear.git
synced 2024-11-22 12:55:05 +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 requirements for pure py3
|
||||||
* Change codebase cleanups
|
* Change codebase cleanups
|
||||||
|
|
||||||
|
[develop changelog]
|
||||||
|
|
||||||
|
* Add logging around the restart/shutdown event
|
||||||
|
|
||||||
|
|
||||||
### 3.27.11 (2023-03-06 23:40:00 UTC)
|
### 3.27.11 (2023-03-06 23:40:00 UTC)
|
||||||
|
|
||||||
|
|
|
@ -769,6 +769,7 @@ class SickGear(object):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def shutdown(self, ev_type):
|
def shutdown(self, ev_type):
|
||||||
|
logger.debug(f'Shutdown ev_type:{ev_type}, sickgear.started:{sickgear.started}')
|
||||||
if sickgear.started:
|
if sickgear.started:
|
||||||
# stop all tasks
|
# stop all tasks
|
||||||
sickgear.halt()
|
sickgear.halt()
|
||||||
|
|
|
@ -1747,6 +1747,7 @@ def restart(soft=True, update_pkg=None):
|
||||||
if update_pkg:
|
if update_pkg:
|
||||||
MY_ARGS.append('--update-pkg')
|
MY_ARGS.append('--update-pkg')
|
||||||
|
|
||||||
|
logger.log(u'Trigger event restart')
|
||||||
events.put(events.SystemEvent.RESTART)
|
events.put(events.SystemEvent.RESTART)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -1770,8 +1771,10 @@ def sig_handler(signum=None, _=None):
|
||||||
def halt():
|
def halt():
|
||||||
global __INITIALIZED__, started
|
global __INITIALIZED__, started
|
||||||
|
|
||||||
|
logger.debug('Check INIT_LOCK on halt')
|
||||||
with INIT_LOCK:
|
with INIT_LOCK:
|
||||||
|
|
||||||
|
logger.debug(f'Check __INITIALIZED__ on halt: {__INITIALIZED__}')
|
||||||
if __INITIALIZED__:
|
if __INITIALIZED__:
|
||||||
|
|
||||||
logger.log('Exiting threads')
|
logger.log('Exiting threads')
|
||||||
|
|
|
@ -32,7 +32,17 @@ class Events(threading.Thread):
|
||||||
try:
|
try:
|
||||||
# get event type
|
# get event type
|
||||||
etype = self.queue.get(True, 1)
|
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
|
# perform callback if we got an event type
|
||||||
self.callback(etype)
|
self.callback(etype)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue