From ac45f8571cc12dce218268ea559454c560b9851e Mon Sep 17 00:00:00 2001 From: Telemaco Date: Tue, 25 Feb 2025 10:06:09 +0100 Subject: [PATCH] Add update of inflight packet at the end of _loop function to ensure retry of sending packets also if there are no messages received from broker. Signed-off-by: tGallimberti-Kerberos --- src/paho/mqtt/client.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/paho/mqtt/client.py b/src/paho/mqtt/client.py index 4ccc8696..428444e3 100644 --- a/src/paho/mqtt/client.py +++ b/src/paho/mqtt/client.py @@ -1704,7 +1704,11 @@ def _loop(self, timeout: float = 1.0) -> MQTTErrorCode: if rc or self._sock is None: return rc - return self.loop_misc() + rc = self.loop_misc() + if rc == MQTT_ERR_SUCCESS: + #Make the main loop to update infight packets + return self._update_inflight() + return rc def publish( self,