From 67190100500819eb1237c4572accafa72816ae54 Mon Sep 17 00:00:00 2001 From: Alan Rominger Date: Wed, 27 Jul 2022 11:50:53 -0400 Subject: [PATCH] Add back in cleanup call --- awx/main/dispatch/pool.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/awx/main/dispatch/pool.py b/awx/main/dispatch/pool.py index 8c36fd7c5740..6a65df95ded0 100644 --- a/awx/main/dispatch/pool.py +++ b/awx/main/dispatch/pool.py @@ -378,8 +378,6 @@ def cleanup(self): 1. Discover worker processes that exited, and recover messages they were handling. 2. Clean up unnecessary, idle workers. - 3. Check to see if the database says this node is running any tasks - that aren't actually running. If so, reap them. IMPORTANT: this function is one of the few places in the dispatcher (aside from setting lookups) where we talk to the database. As such, @@ -465,6 +463,9 @@ def write(self, preferred_queue, body): try: if isinstance(body, dict) and body.get('bind_kwargs'): self.add_bind_kwargs(body) + # when the cluster heartbeat occurs, clean up internally + if isinstance(body, dict) and 'cluster_node_heartbeat' in body['task']: + self.cleanup() if self.should_grow: self.up() # we don't care about "preferred queue" round robin distribution, just