From ea509010dcf04fd6ec8820d6b74b3a78b8b1d951 Mon Sep 17 00:00:00 2001 From: NeonKirill Date: Thu, 2 Jan 2025 18:51:29 +0100 Subject: [PATCH] Reconnect if ioloop fails to get started --- neon_mq_connector/consumers/select_consumer.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/neon_mq_connector/consumers/select_consumer.py b/neon_mq_connector/consumers/select_consumer.py index 2dad745..ef901dc 100644 --- a/neon_mq_connector/consumers/select_consumer.py +++ b/neon_mq_connector/consumers/select_consumer.py @@ -207,8 +207,8 @@ def run(self): self.connection: pika.SelectConnection = self.create_connection() self.connection.ioloop.start() except Exception as e: - LOG.error(f"Failed to start io loop on consumer thread {self.name!r}: {e}") - self._close_connection() + LOG.error(f"Failed to start io loop on consumer thread {self.name!r}: {e}, reconnecting") + self.reconnect() def _close_connection(self, mark_consumer_as_dead: bool = True): try: