From 2d8078b8bb6cc3e783f0d539887007fa7a6fb66b Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Sat, 10 Nov 2018 01:16:32 +0100 Subject: [PATCH] Don't propagate the message from MQTT nor wait for a response if the message is null or its handler threw an exception --- platypush/backend/mqtt.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platypush/backend/mqtt.py b/platypush/backend/mqtt.py index 2a26fd7f..c4f361e6 100644 --- a/platypush/backend/mqtt.py +++ b/platypush/backend/mqtt.py @@ -108,6 +108,7 @@ class MqttBackend(Backend): msg = msg.payload.decode('utf-8') try: msg = Message.build(json.loads(msg)) except: pass + if not msg: return self.logger.info('Received message on the MQTT backend: {}'.format(msg)) @@ -115,6 +116,7 @@ class MqttBackend(Backend): self.on_message(msg) except Exception as e: self.logger.exception(e) + return if isinstance(msg, Request): threading.Thread(target=response_thread, args=(msg,)).start()