From 0ccbf1b809ece7f1753e7e6b11b722527cd192a5 Mon Sep 17 00:00:00 2001 From: David Duque Date: Sun, 21 Jun 2020 15:05:17 +0100 Subject: [PATCH] Only spawn a thread pool when strictly needed For --check-primary-hostname, the pool is not used. When exiting, the other processes are left alive and will hang. --- management/status_checks.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/management/status_checks.py b/management/status_checks.py index 21aa58dc..64f28b7b 100755 --- a/management/status_checks.py +++ b/management/status_checks.py @@ -983,12 +983,13 @@ if __name__ == "__main__": from utils import load_environment env = load_environment() - pool = multiprocessing.pool.Pool(processes=10) if len(sys.argv) == 1: + pool = multiprocessing.pool.Pool(processes=10) run_checks(False, env, ConsoleOutput(), pool) elif sys.argv[1] == "--show-changes": + pool = multiprocessing.pool.Pool(processes=10) run_and_output_changes(env, pool) elif sys.argv[1] == "--check-primary-hostname":