From: Michael Tremer Date: Thu, 28 Feb 2013 18:26:36 +0000 (+0100) Subject: daemon: Make shutting down a bit faster. X-Git-Tag: 0.9.25~6 X-Git-Url: http://git.ipfire.org/?p=people%2Fms%2Fpakfire.git;a=commitdiff_plain;h=fa736f5a879d8be263a398605557322a314635d5 daemon: Make shutting down a bit faster. First, send SIGTERM to all processes and then wait until they all have finished. --- diff --git a/python/pakfire/daemon.py b/python/pakfire/daemon.py index 59800cfd..8c453e0c 100644 --- a/python/pakfire/daemon.py +++ b/python/pakfire/daemon.py @@ -144,15 +144,15 @@ class PakfireDaemon(object): """ Terminates all workers. """ + # First send SIGTERM to all processes. + self.terminate_worker(self.keepalive) for worker in self.workers: self.terminate_worker(worker) - # Wait until the worker has finished. - worker.join() - - # Terminate the keepalive process. - self.terminate_worker(self.keepalive) + # Then wait until they all have finished. self.keepalive.join() + for worker in self.workers: + worker.join() def remove_worker(self, worker): """