fix: add error handling for file not found error

When a file couldn't be downloaded from storage, the queue consumer now
informs the operator with a log and rejects the message, without crashing
but continuing its honest work.
This commit is contained in:
Julius Unverfehrt 2024-04-16 16:20:05 +02:00
parent 876253b3fb
commit 021222475b

View File

@ -184,6 +184,9 @@ class QueueManager:
channel.basic_ack(delivery_tag=method.delivery_tag)
logger.debug(f"Message with {method.delivery_tag=} acknowledged.")
except FileNotFoundError as e:
logger.warning(f"{e}, declining message with {method.delivery_tag=}.")
channel.basic_nack(method.delivery_tag, requeue=False)
except Exception:
logger.warning(f"Failed to process message with {method.delivery_tag=}, declining...", exc_info=True)
channel.basic_nack(method.delivery_tag, requeue=False)