We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent aae6f1f commit 2381b1eCopy full SHA for 2381b1e
1 file changed
roborock/mqtt/roborock_session.py
@@ -86,12 +86,13 @@ async def start(self) -> None:
86
async def close(self) -> None:
87
"""Cancels the MQTT loop and shutdown the client library."""
88
self._stop = True
89
- if self._reconnect_task:
90
- self._reconnect_task.cancel()
91
- try:
92
- await self._reconnect_task
93
- except asyncio.CancelledError:
94
- pass
+ tasks = [task for task in [self._connection_task, self._reconnect_task] if task]
+ for task in tasks:
+ task.cancel()
+ try:
+ await asyncio.gather(*tasks)
+ except asyncio.CancelledError:
95
+ pass
96
97
self._healthy = False
98
0 commit comments