fix: MQTT schedule the reconnect timer before calling disconnect(), so by the time _on_broker_disconnected fires, the pending reconnect is already visible.

This commit is contained in:
Lloyd
2026-03-24 12:33:33 +00:00
parent 7fcad04f49
commit d82c90a04d

View File

@@ -322,8 +322,9 @@ class _BrokerConnection:
logger.info(f"JWT token expiring soon for {self.broker['name']}, refreshing...")
self._running = False
self._jwt_refresh_timer = None
self.client.disconnect() # Triggers clean disconnect, then reconnect via timer
self._schedule_reconnect(reason="JWT token expiry")
self.client.disconnect()
# ====================================================================