From 88b4c5c7ce9852b8aa4bdd6b760f4c8b708df62b Mon Sep 17 00:00:00 2001 From: Julius Unverfehrt Date: Wed, 24 Aug 2022 15:00:00 +0200 Subject: [PATCH] Pull request #51: RED-5009 pyinfra now truly rejects messages that couldn't be processed by the callback Merge in RR/pyinfra from RED-5009-fix-ack-bug to master Squashed commit of the following: commit 7b00edf6fe1167345e774d658fcd2e60c01d05d5 Author: Julius Unverfehrt Date: Wed Aug 24 14:52:57 2022 +0200 RED-5009 pyinfra now truly rejects messages that couldn't be processed by the callback (e.g. inobtainable storage file) --- pyinfra/queue/queue_manager.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pyinfra/queue/queue_manager.py b/pyinfra/queue/queue_manager.py index e5cf5d2..cb30d52 100644 --- a/pyinfra/queue/queue_manager.py +++ b/pyinfra/queue/queue_manager.py @@ -120,6 +120,7 @@ class QueueManager(object): self.logger.info(f"Aborting message processing for delivery_tag {frame.delivery_tag} " f"due to it being redelivered") self._channel.basic_nack(frame.delivery_tag, requeue=False) + return self.logger.debug(f"Processing {(frame, properties, body)}.") try: @@ -138,6 +139,7 @@ class QueueManager(object): self._channel.basic_ack(frame.delivery_tag) else: self.logger.info(f"Processed message with delivery_tag {frame.delivery_tag}, declining message") + self._channel.basic_nack(frame.delivery_tag, requeue=False) except Exception as ex: n_attempts = _get_n_previous_attempts(properties) + 1