RED-5009 pyinfra now truly rejects messages that couldn't be processed by the callback (e.g. inobtainable storage file)

This commit is contained in:
Julius Unverfehrt 2022-08-24 14:52:57 +02:00
parent 71ad2af4eb
commit 7b00edf6fe

View File

@ -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