From cad184fc1f461f57941957ee2c45fe2c7963889e Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Mon, 22 Mar 2021 02:06:07 +0100 Subject: [PATCH] MQTT_ERR_NOMEM should not result in a reconnection --- CHANGELOG.md | 2 ++ platypush/backend/mqtt.py | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a4b3ca4bc..c0b9c0777 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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] +- Added reconnection logic to `backend.mqtt` listeners in case of temporary MQTT server-side errors. + ## [0.20.6] - 2021-03-16 ### Added diff --git a/platypush/backend/mqtt.py b/platypush/backend/mqtt.py index 427d7e554..8722c2be8 100644 --- a/platypush/backend/mqtt.py +++ b/platypush/backend/mqtt.py @@ -83,7 +83,7 @@ class MqttClient(mqtt.Client, threading.Thread): # noinspection PyUnusedLocal 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, - 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_QUEUE_SIZE, mqtt.MQTT_ERR_UNKNOWN}: self.logger.warning('Unexpected disconnection from {}:{}. MQTT error: {}'.format(