rabbit: Fixed auto_ack with generator consumer

This commit is contained in:
2021-01-03 23:35:04 +03:00
parent 668e4b5044
commit 13d8911220

View File

@@ -91,5 +91,7 @@ def consume_task(channel, queue: str, timeout=None, auto_ack=True, max_count=Non
yield body
if max_count and method.delivery_tag == max_count:
break
if not auto_ack:
channel.basic_ack(delivery_tag=method.delivery_tag)
requeued_messages = channel.cancel()
_logger.info(f"Requeued {requeued_messages} messages")