From 15b3cc352f0cbdde4820b5e2c8e69c422b60d6df Mon Sep 17 00:00:00 2001 From: bwarsaw Date: Wed, 11 Jul 2001 20:10:15 +0000 Subject: start_runner(): Changed indentation, since the parent always returns. Also added a note why "mailmanctl restart" doesn't Do The Right Thing w.r.t. allowing the subrunners to re-import various Mailman modules. --- Mailman/Queue/Control.py | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'Mailman/Queue') diff --git a/Mailman/Queue/Control.py b/Mailman/Queue/Control.py index ddb75d80c..8646da2cd 100644 --- a/Mailman/Queue/Control.py +++ b/Mailman/Queue/Control.py @@ -91,20 +91,26 @@ def start_runner(qrclass, slice, count): if pid: # parent return pid - else: - # child - qrunner = qrclass(slice, count) - def sighup_handler(signum, frame, qrunner=qrunner): - # Exit the qrunner cleanly. - qrunner.stop() - syslog('qrunner', '%s qrunner caught SIGHUP. Stopping.' % - qrunner.__class__.__name__) - # Enable the child's SIGHUP handler - signal.signal(signal.SIGHUP, sighup_handler) - syslog('qrunner', '%s qrunner started.', qrclass.__name__) - qrunner.run() - syslog('qrunner', '%s qrunner exiting.', qrclass.__name__) - os._exit(0) + # child + # + # BAW: We need to think of a good way to force the reloading of Mailman + # modules so that a "mailmanctl restart" will utilize any updated code. + # Clearing sys.modules is one way, but it has nasty side effects. Hmm, + # maybe exec'ing a new process image is the right thing to do? + # + # Now instantiate the qrunner class + qrunner = qrclass(slice, count) + def sighup_handler(signum, frame, qrunner=qrunner): + # Exit the qrunner cleanly. + qrunner.stop() + syslog('qrunner', '%s qrunner caught SIGHUP. Stopping.' % + qrunner.__class__.__name__) + # Enable the child's SIGHUP handler + signal.signal(signal.SIGHUP, sighup_handler) + syslog('qrunner', '%s qrunner started.', qrclass.__name__) + qrunner.run() + syslog('qrunner', '%s qrunner exiting.', qrclass.__name__) + os._exit(0) -- cgit v1.2.3-70-g09d2