summaryrefslogtreecommitdiff
path: root/src/mailman/core/runner.py
diff options
context:
space:
mode:
authorBarry Warsaw2017-02-01 20:12:02 -0500
committerBarry Warsaw2017-02-01 20:12:02 -0500
commitd113a345131b07e6b2001621556f71deea1ba771 (patch)
treea11be2123be11dda86564757d3950b0cb3d0e162 /src/mailman/core/runner.py
parent80cc5ffdd24b85e242ab596f3b991f140bb16dfb (diff)
downloadmailman-d113a345131b07e6b2001621556f71deea1ba771.tar.gz
mailman-d113a345131b07e6b2001621556f71deea1ba771.tar.zst
mailman-d113a345131b07e6b2001621556f71deea1ba771.zip
Diffstat (limited to 'src/mailman/core/runner.py')
-rw-r--r--src/mailman/core/runner.py29
1 files changed, 15 insertions, 14 deletions
diff --git a/src/mailman/core/runner.py b/src/mailman/core/runner.py
index 9f8094153..707ad5e07 100644
--- a/src/mailman/core/runner.py
+++ b/src/mailman/core/runner.py
@@ -92,23 +92,24 @@ class Runner:
signal.SIGINT: 'SIGINT',
signal.SIGUSR1: 'SIGUSR1',
}.get(signum, signum)
- if signum in (signal.SIGTERM, signal.SIGINT, signal.SIGUSR1):
+ if signum == signal.SIGHUP:
+ reopen()
+ rlog.info('%s runner caught SIGHUP. Reopening logs.', self.name)
+ elif signum in (signal.SIGTERM, signal.SIGINT, signal.SIGUSR1):
self.stop()
self.status = signum
rlog.info('%s runner caught %s. Stopping.', self.name, signame)
- elif signum == signal.SIGHUP:
- reopen()
- rlog.info('%s runner caught SIGHUP. Reopening logs.', self.name)
- # As of Python 3.5, PEP 475 gets in our way. Runners with long
- # time.sleep()'s in their _snooze() method (e.g. the retry runner) will
- # have their system call implemented time.sleep() automatically retried
- # at the C layer. The only reliable way to prevent this is to raise an
- # exception in the signal handler. The standard run() method
- # automatically suppresses this exception, meaning, it's caught and
- # ignored, but effectively breaks the run() loop, which is just what we
- # want. Runners which implement their own run() method must be
- # prepared to catch RunnerInterrupts, usually also ignoring them.
- raise RunnerInterrupt
+ # As of Python 3.5, PEP 475 gets in our way. Runners with long
+ # time.sleep()'s in their _snooze() method (e.g. the retry runner)
+ # will have their system call implemented time.sleep()
+ # automatically retried at the C layer. The only reliable way to
+ # prevent this is to raise an exception in the signal handler. The
+ # standard run() method automatically suppresses this exception,
+ # meaning, it's caught and ignored, but effectively breaks the
+ # run() loop, which is just what we want. Runners which implement
+ # their own run() method must be prepared to catch
+ # RunnerInterrupts, usually also ignoring them.
+ raise RunnerInterrupt
def set_signals(self):
"""See `IRunner`."""