mirror of
https://github.com/jketterl/openwebrx.git
synced 2025-12-06 07:12:09 +01:00
Merge pull request #383 from luarvique/mqtt-develop
Fixed failed MQTT connection blocking OWRX startup.
This commit is contained in:
commit
89bff7a819
|
|
@ -40,7 +40,11 @@ class MqttReporter(Reporter):
|
||||||
host = parts[0]
|
host = parts[0]
|
||||||
if len(parts) > 1:
|
if len(parts) > 1:
|
||||||
port = int(parts[1])
|
port = int(parts[1])
|
||||||
|
|
||||||
|
try:
|
||||||
client.connect(host=host, port=port)
|
client.connect(host=host, port=port)
|
||||||
|
except:
|
||||||
|
logger.exception("Exception connecting to MQTT server")
|
||||||
|
|
||||||
threading.Thread(target=client.loop_forever).start()
|
threading.Thread(target=client.loop_forever).start()
|
||||||
|
|
||||||
|
|
@ -53,6 +57,7 @@ class MqttReporter(Reporter):
|
||||||
self.topic = topic
|
self.topic = topic
|
||||||
|
|
||||||
def _reconnect(self, *args, **kwargs):
|
def _reconnect(self, *args, **kwargs):
|
||||||
|
logger.debug("Reconnecting...")
|
||||||
old = self.client
|
old = self.client
|
||||||
self.client = self._getClient()
|
self.client = self._getClient()
|
||||||
old.disconnect()
|
old.disconnect()
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue