From c5985c4c81f84403f6d36baca3bb51024bc8bd29 Mon Sep 17 00:00:00 2001 From: Alan Rominger Date: Thu, 28 Jul 2022 09:16:08 -0400 Subject: [PATCH] Change lazy worker method name and adjust log --- awx/main/dispatch/pool.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/awx/main/dispatch/pool.py b/awx/main/dispatch/pool.py index 030f660ef5..a255e168cd 100644 --- a/awx/main/dispatch/pool.py +++ b/awx/main/dispatch/pool.py @@ -195,7 +195,7 @@ class PoolWorker(object): return not self.busy @property - def lazy(self): + def ready_to_scale_down(self): if self.busy: return False if self.last_finished is None: @@ -398,12 +398,12 @@ class AutoscalePool(WorkerPool): logger.exception('failed to reap job UUID {}'.format(w.current_task['uuid'])) orphaned.extend(w.orphaned_tasks) self.workers.remove(w) - elif w.lazy and len(self.workers) > self.min_workers: + elif (len(self.workers) > self.min_workers) and w.ready_to_scale_down: # the process has an empty queue (it's idle) and we have # more processes in the pool than we need (> min) # send this process a message so it will exit gracefully # at the next opportunity - logger.info(f'scaling down worker pid:{w.pid} from:{len(self.workers)}') + logger.info(f'scaling down worker pid:{w.pid} prior total:{len(self.workers)}') w.quit() self.workers.remove(w) if w.alive: