Always define msg so the function doesn't fail on exception

Reverted the previous retry logic for backend - it didn't really work

This reverts commit 4e0e4863a0.
This reverts commit 964c7b5cf0.
This reverts commit 6ce348365f.
This commit is contained in:
Fabio Manganiello 2018-10-25 20:45:58 +02:00
parent 4e0e4863a0
commit 284e0638f8
28 changed files with 267 additions and 273 deletions
platypush/backend

View file

@ -45,7 +45,7 @@ class MqttBackend(Backend):
publisher.single(self.topic, str(msg), hostname=self.host, port=self.port)
def exec(self):
def run(self):
def on_connect(client, userdata, flags, rc):
client.subscribe(self.topic)
@ -57,6 +57,7 @@ class MqttBackend(Backend):
self.logger.info('Received message on the MQTT backend: {}'.format(msg))
self.on_message(msg)
super().run()
client = mqtt.Client()
client.on_connect = on_connect
client.on_message = on_message