api: ensure mqtt futures exists as attributes
All checks were successful
Build Container / Build Container (push) Successful in 4m41s
All checks were successful
Build Container / Build Container (push) Successful in 4m41s
We were running into a bug where, during a server initiated disconnect, the client would try to read an attribute on its instance that had never been written to. This resulted in an AttributeError exception being thrown that effectively killed the whole MQTT task and kept the app from ever doing any MQTT related things again.
This commit is contained in:
parent
fde2254e51
commit
57fa0aa4a0
1 changed files with 4 additions and 0 deletions
|
|
@ -78,6 +78,10 @@ class AsyncMqttClient:
|
||||||
self.client.on_subscribe = self.on_subscribe
|
self.client.on_subscribe = self.on_subscribe
|
||||||
self.client.on_unsubscribe = self.on_unsubscribe
|
self.client.on_unsubscribe = self.on_unsubscribe
|
||||||
self.client.on_disconnect = self.on_disconnect
|
self.client.on_disconnect = self.on_disconnect
|
||||||
|
self.fut_disconnect = None
|
||||||
|
self.fut_connected = None
|
||||||
|
self.fut_subscribe = None
|
||||||
|
self.fut_unsubscribe = None
|
||||||
|
|
||||||
def on_connect(
|
def on_connect(
|
||||||
self,
|
self,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue