fix: stop MQTT internal loop immediately when main loop is closed (#1484)

This commit is contained in:
vshijiav
2025-11-06 18:18:25 -08:00
committed by GitHub
parent c04fa542a3
commit 1ec325c9c7

View File

@@ -589,6 +589,13 @@ class _MipsClient(ABC):
def __mqtt_loop_handler(self) -> None:
try:
# If the main loop is closed, stop the internal loop immediately
if self.main_loop.is_closed():
self.log_debug(
'The main loop is closed, stop the internal loop.')
if not self._internal_loop.is_closed():
self._internal_loop.stop()
return
if self._mqtt:
self._mqtt.loop_read()
if self._mqtt: