RED-4049 fix: Pyinfra now retries to reconnect after AMPQ connection loss and eventually throws an error if unsuccessful, forcing container restart.
This commit is contained in:
parent
d95b483917
commit
1baafb781c
@ -51,12 +51,11 @@ def main():
|
||||
response_strategy = StorageStrategy(storage)
|
||||
visitor = QueueVisitor(storage, callback, response_strategy)
|
||||
|
||||
queue_manager = PikaQueueManager(CONFIG.rabbitmq.queues.input, CONFIG.rabbitmq.queues.output)
|
||||
|
||||
@retry(ConsumerError, tries=3, delay=5, jitter=(1, 3))
|
||||
def consume():
|
||||
consumer = Consumer(visitor, queue_manager)
|
||||
try:
|
||||
try: # RED-4049 queue manager needs to be in try scope to eventually throw Exception after connection loss.
|
||||
queue_manager = PikaQueueManager(CONFIG.rabbitmq.queues.input, CONFIG.rabbitmq.queues.output)
|
||||
consumer = Consumer(visitor, queue_manager)
|
||||
consumer.basic_consume_and_publish()
|
||||
except Exception as err:
|
||||
raise ConsumerError from err
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user