[FIX] workers: process signals during graceful shutdown to allow force shutdown
Required aftere17844c946
which enabled graceful shutdown of workers, including the cron worker. The latter may typically be busy on long-running tasks that will not be aborted by a simple graceful shutdown request. A typical shutdown sequence initiated by a daemon manager such as start-stop-daemon will involve multiple SIGTERM signals to ensure the process really stops in a timely manner. This was not possible aftere17844c946
if any cron worker was busy.
This commit is contained in:
parent
d0e39720e3
commit
e8e3f75727
|
@ -186,6 +186,11 @@ class Multicorn(object):
|
||||||
for pid in self.workers.keys():
|
for pid in self.workers.keys():
|
||||||
self.worker_kill(pid, signal.SIGINT)
|
self.worker_kill(pid, signal.SIGINT)
|
||||||
while self.workers and time.time() < limit:
|
while self.workers and time.time() < limit:
|
||||||
|
try:
|
||||||
|
self.process_signals()
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
_logger.info("Forced shutdown.")
|
||||||
|
break
|
||||||
self.process_zombie()
|
self.process_zombie()
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Reference in New Issue