Skip to content

Commit

Permalink
Merge pull request #383 from luarvique/mqtt-develop
Browse files Browse the repository at this point in the history
Fixed failed MQTT connection blocking OWRX startup.
  • Loading branch information
jketterl authored May 23, 2024
2 parents 10c642e + cc74dcb commit 89bff7a
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion owrx/reporting/mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ def _getClient(self):
host = parts[0]
if len(parts) > 1:
port = int(parts[1])
client.connect(host=host, port=port)

try:
client.connect(host=host, port=port)
except:
logger.exception("Exception connecting to MQTT server")

threading.Thread(target=client.loop_forever).start()

Expand All @@ -53,6 +57,7 @@ def _setTopic(self, topic):
self.topic = topic

def _reconnect(self, *args, **kwargs):
logger.debug("Reconnecting...")
old = self.client
self.client = self._getClient()
old.disconnect()
Expand Down

0 comments on commit 89bff7a

Please sign in to comment.