From d14a55911b137c123cd76adbf6e5c2a4b77d9c2f Mon Sep 17 00:00:00 2001 From: Chris Meyers Date: Fri, 28 Apr 2017 13:46:54 -0400 Subject: [PATCH] ack fact scan messages * Fixes a bug where fact rabbit messages would build up because we never explicitly ack them. --- awx/main/management/commands/run_fact_cache_receiver.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/awx/main/management/commands/run_fact_cache_receiver.py b/awx/main/management/commands/run_fact_cache_receiver.py index 5a111c6fa2..f7d843d5fa 100644 --- a/awx/main/management/commands/run_fact_cache_receiver.py +++ b/awx/main/management/commands/run_fact_cache_receiver.py @@ -61,12 +61,15 @@ class FactBrokerWorker(ConsumerMixin): host_obj = Host.objects.get(name=hostname, inventory__id=inventory_id) except Fact.DoesNotExist: logger.warn('Failed to intake fact. Host does not exist <%s, %s>' % (hostname, inventory_id)) + message.ack() return except Fact.MultipleObjectsReturned: logger.warn('Database inconsistent. Multiple Hosts found for <%s, %s>.' % (hostname, inventory_id)) + message.ack() return None except Exception as e: logger.error("Exception communicating with Fact Cache Database: %s" % str(e)) + message.ack() return None (module_name, facts) = self.process_facts(facts_data) @@ -84,6 +87,7 @@ class FactBrokerWorker(ConsumerMixin): logger.info('Created new fact <%s, %s>' % (fact_obj.id, module_name)) analytics_logger.info('Received message with fact data', extra=dict( module_name=module_name, facts_data=facts)) + message.ack() return fact_obj