Don't propagate the message from MQTT nor wait for a response if the message is null or its handler threw an exception
This commit is contained in:
parent
cda64865f3
commit
2d8078b8bb
1 changed files with 2 additions and 0 deletions
|
@ -108,6 +108,7 @@ class MqttBackend(Backend):
|
||||||
msg = msg.payload.decode('utf-8')
|
msg = msg.payload.decode('utf-8')
|
||||||
try: msg = Message.build(json.loads(msg))
|
try: msg = Message.build(json.loads(msg))
|
||||||
except: pass
|
except: pass
|
||||||
|
if not msg: return
|
||||||
|
|
||||||
self.logger.info('Received message on the MQTT backend: {}'.format(msg))
|
self.logger.info('Received message on the MQTT backend: {}'.format(msg))
|
||||||
|
|
||||||
|
@ -115,6 +116,7 @@ class MqttBackend(Backend):
|
||||||
self.on_message(msg)
|
self.on_message(msg)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.exception(e)
|
self.logger.exception(e)
|
||||||
|
return
|
||||||
|
|
||||||
if isinstance(msg, Request):
|
if isinstance(msg, Request):
|
||||||
threading.Thread(target=response_thread, args=(msg,)).start()
|
threading.Thread(target=response_thread, args=(msg,)).start()
|
||||||
|
|
Loading…
Reference in a new issue