]> git.ipfire.org Git - pakfire.git/commitdiff
daemon: Make shutting down a bit faster.
authorMichael Tremer <michael.tremer@ipfire.org>
Thu, 28 Feb 2013 18:26:36 +0000 (19:26 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 28 Feb 2013 18:26:36 +0000 (19:26 +0100)
First, send SIGTERM to all processes and then wait
until they all have finished.

python/pakfire/daemon.py

index 59800cfd6d62e7792f2363bc85f0b6f69951a3f1..8c453e0c2d1f87b7d1e378260e3b87989af47436 100644 (file)
@@ -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):
                """