From 76985e83edb95f8ea8c6db2974d232de08b3c79e Mon Sep 17 00:00:00 2001 From: Viktor Seifert Date: Mon, 1 Aug 2022 13:25:53 +0200 Subject: [PATCH] RED-4653: Added some debugging code to test if closing the connection needed --- pyinfra/queue/queue_manager.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/pyinfra/queue/queue_manager.py b/pyinfra/queue/queue_manager.py index 7762ffc..5021114 100644 --- a/pyinfra/queue/queue_manager.py +++ b/pyinfra/queue/queue_manager.py @@ -3,6 +3,7 @@ import json import logging import signal from typing import Callable +from os import environ import pika import pika.exceptions @@ -58,7 +59,9 @@ class QueueManager(object): def _close_channel(self): self._channel.close() - self._connection.close() + + if environ.get("CLOSE_CONNECTION", False) == "True": + self._connection.close() def start_consuming(self, process_message_callback: Callable): self._open_channel()