mirror of
https://github.com/jlu5/PyLink.git
synced 2025-01-24 11:14:07 +01:00
control: print remaining threads on forced shutdowns as well
This commit is contained in:
parent
5c7752a203
commit
59dd8d3bf8
@ -19,10 +19,14 @@ def remove_network(ircobj):
|
|||||||
ircobj.disconnect()
|
ircobj.disconnect()
|
||||||
del world.networkobjects[ircobj.name]
|
del world.networkobjects[ircobj.name]
|
||||||
|
|
||||||
|
def _print_remaining_threads():
|
||||||
|
log.debug('_shutdown(): Remaining threads: %s', ['%s/%s' % (t.name, t.ident) for t in threading.enumerate()])
|
||||||
|
|
||||||
def _shutdown(irc=None):
|
def _shutdown(irc=None):
|
||||||
"""Shuts down the Pylink daemon."""
|
"""Shuts down the Pylink daemon."""
|
||||||
global tried_shutdown
|
global tried_shutdown
|
||||||
if tried_shutdown: # We froze on shutdown last time, so immediately abort.
|
if tried_shutdown: # We froze on shutdown last time, so immediately abort.
|
||||||
|
_print_remaining_threads()
|
||||||
raise KeyboardInterrupt("Forcing shutdown.")
|
raise KeyboardInterrupt("Forcing shutdown.")
|
||||||
|
|
||||||
tried_shutdown = True
|
tried_shutdown = True
|
||||||
@ -52,7 +56,7 @@ def _shutdown(irc=None):
|
|||||||
|
|
||||||
log.info("Waiting for remaining threads to stop; this may take a few seconds. If PyLink freezes "
|
log.info("Waiting for remaining threads to stop; this may take a few seconds. If PyLink freezes "
|
||||||
"at this stage, press Ctrl-C to force a shutdown.")
|
"at this stage, press Ctrl-C to force a shutdown.")
|
||||||
log.debug('_shutdown(): Remaining threads: %s', ['%s/%s' % (t.name, t.ident) for t in threading.enumerate()])
|
_print_remaining_threads()
|
||||||
|
|
||||||
# Done.
|
# Done.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user