MQTT_ERR_NOMEM should not result in a reconnection

This commit is contained in:
Fabio Manganiello 2021-03-22 02:06:07 +01:00
parent 928bb3667a
commit cad184fc1f
2 changed files with 3 additions and 1 deletions

View File

@ -11,6 +11,8 @@ Given the high speed of development in the first phase, changes are being report
- Fixed dashboard widgets custom classes being propagated both to the container and to the widget content [see #179] - Fixed dashboard widgets custom classes being propagated both to the container and to the widget content [see #179]
- Added reconnection logic to `backend.mqtt` listeners in case of temporary MQTT server-side errors.
## [0.20.6] - 2021-03-16 ## [0.20.6] - 2021-03-16
### Added ### Added

View File

@ -83,7 +83,7 @@ class MqttClient(mqtt.Client, threading.Thread):
# noinspection PyUnusedLocal # noinspection PyUnusedLocal
def handler(client, userdata, rc): def handler(client, userdata, rc):
if not self._stop_scheduled and rc in {mqtt.MQTT_ERR_INVAL, mqtt.MQTT_ERR_AGAIN, mqtt.MQTT_ERR_CONN_LOST, if not self._stop_scheduled and rc in {mqtt.MQTT_ERR_INVAL, mqtt.MQTT_ERR_AGAIN, mqtt.MQTT_ERR_CONN_LOST,
mqtt.MQTT_ERR_CONN_REFUSED, mqtt.MQTT_ERR_NOMEM, mqtt.MQTT_ERR_ERRNO, mqtt.MQTT_ERR_CONN_REFUSED, mqtt.MQTT_ERR_ERRNO,
mqtt.MQTT_ERR_NO_CONN, mqtt.MQTT_ERR_PAYLOAD_SIZE, mqtt.MQTT_ERR_NO_CONN, mqtt.MQTT_ERR_PAYLOAD_SIZE,
mqtt.MQTT_ERR_QUEUE_SIZE, mqtt.MQTT_ERR_UNKNOWN}: mqtt.MQTT_ERR_QUEUE_SIZE, mqtt.MQTT_ERR_UNKNOWN}:
self.logger.warning('Unexpected disconnection from {}:{}. MQTT error: {}'.format( self.logger.warning('Unexpected disconnection from {}:{}. MQTT error: {}'.format(