Add dump running threads by SIGUSR1

This commit is contained in:
norohind 2022-04-21 13:07:41 +03:00
parent 04cccabfa2
commit a552fc0361
Signed by: norohind
GPG Key ID: 01C3BECC26FB59E1

View File

@ -57,6 +57,11 @@ def shutdown_callback(sig: int, frame) -> None:
exit(0)
def threads_dump(sig: int, frame) -> None:
running_threads = ', '.join((thread.name for thread in threading.enumerate()))
logger.info(f'Running threads: {running_threads}')
def discover(back_count: int = 0):
"""Discover new squads
:param back_count: int how many squads back we should check, it is helpful to recheck newly created squads
@ -153,6 +158,7 @@ def main():
global can_be_shutdown
signal.signal(signal.SIGTERM, shutdown_callback)
signal.signal(signal.SIGINT, shutdown_callback)
signal.signal(signal.SIGUSR1, threads_dump)
def help_cli() -> str:
return """Possible arguments: