From 4f9a3ab0a661423dee929aa58b5bc015d07fc6dd Mon Sep 17 00:00:00 2001 From: imbeacon Date: Tue, 3 Dec 2024 10:51:47 +0200 Subject: [PATCH] Fix for spamming in logs --- thingsboard_gateway/connectors/mqtt/mqtt_connector.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/thingsboard_gateway/connectors/mqtt/mqtt_connector.py b/thingsboard_gateway/connectors/mqtt/mqtt_connector.py index c5255509..bfcfea07 100644 --- a/thingsboard_gateway/connectors/mqtt/mqtt_connector.py +++ b/thingsboard_gateway/connectors/mqtt/mqtt_connector.py @@ -368,7 +368,10 @@ def __connect(self): if not self._connected: sleep(1) except (ConnectionRefusedError, ConnectionResetError, ssl.SSLEOFError, socket.timeout) as e: - self.__log.error(e) + self.__log.error("Error while connecting to broker %s: %s", self.get_name(), e) + sleep(10) + except Exception as e: + self.__log.exception("Error while connecting to broker %s: %s", self.get_name(), e) sleep(10) def close(self):