1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-02 01:21:21 +03:00

disabled instance stay subscribed to bcast queue

* A disabled node needs to stay subscribed to the broadcast queue
because the work to re-subscribe the node to queues when the node is
re-enabled is done over the broadcast queue.
This commit is contained in:
chris meyers 2018-05-09 12:18:59 -04:00
parent e5dd3a9626
commit 4761e17566

View File

@ -25,10 +25,11 @@ def _add_remove_celery_worker_queues(app, controlled_instances, worker_queues, w
bcast_queue_names = set([construct_bcast_queue_name(n) for n in settings.AWX_CELERY_BCAST_QUEUES_STATIC])
all_queue_names = ig_names | hostnames | set(settings.AWX_CELERY_QUEUES_STATIC)
desired_queues = bcast_queue_names | (all_queue_names if instance.enabled else set())
# Remove queues that aren't in the instance group
# Remove queues
for queue_name in worker_queue_names:
if queue_name not in all_queue_names | bcast_queue_names or not instance.enabled:
if queue_name not in desired_queues:
app.control.cancel_consumer(queue_name.encode("utf8"), reply=True, destination=[worker_name])
removed_queues.append(queue_name.encode("utf8"))