3
0
mirror of https://github.com/jlu5/PyLink.git synced 2024-11-01 17:29:21 +01:00

control: handle SIGUSR1 as well as SIGHUP as rehash

This is used by the backported launcher for rehash.
This commit is contained in:
James Lu 2018-03-30 23:06:58 -07:00
parent b5735702f7
commit 7d5d5a385e

View File

@ -138,10 +138,11 @@ def _rehash():
log.info('Finished reloading PyLink configuration.') log.info('Finished reloading PyLink configuration.')
if os.name == 'posix': if os.name == 'posix':
# Only register SIGHUP on *nix. # Only register SIGHUP/SIGUSR1 on *nix.
def sighup_handler(_signo, _stack_frame): def _sighup_handler(signo, _stack_frame):
"""Handles SIGHUP by rehashing the PyLink daemon.""" """Handles SIGHUP/SIGUSR1 by rehashing the PyLink daemon."""
log.info("SIGHUP received, reloading config.") log.info("Signal %s received, reloading config." % signo)
_rehash() _rehash()
signal.signal(signal.SIGHUP, sighup_handler) signal.signal(signal.SIGHUP, _sighup_handler)
signal.signal(signal.SIGUSR1, _sighup_handler)