From 590730e6ef92a9dd3391c37be0860edb7443be80 Mon Sep 17 00:00:00 2001 From: Stefan Lehmann Date: Wed, 29 Apr 2020 17:06:56 +0200 Subject: [PATCH] Remove reconnect from publish Fixes #43 --- CHANGELOG.md | 4 ++++ flask_mqtt/__init__.py | 3 --- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a513ab9..455a880 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Changelog All notable changes to this project will be documented in this file. + The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ## 1.1.1 [unreleased] @@ -10,6 +11,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/). ### Changed ### Removed +* [#43](https://github.com/stlehmann/Flask-MQTT/issues/43) Remove reconnect for +publish function. If you want to reconnect to server check the return value for +MQTT_ERR_NO_CONN and call reconnect function. ## 1.1.0 * drop support for Python 2.7 and Python <= 3.5 diff --git a/flask_mqtt/__init__.py b/flask_mqtt/__init__.py index b23a583..0ffeae4 100644 --- a/flask_mqtt/__init__.py +++ b/flask_mqtt/__init__.py @@ -383,9 +383,6 @@ def publish( ID for the publish request. """ - if not self.connected: - self.client.reconnect() - result, mid = self.client.publish(topic, payload, qos, retain) if result == MQTT_ERR_SUCCESS: logger.debug("Published topic {0}: {1}".format(topic, payload))