Skip to content

Commit b0aa5f9

Browse files
Potential fix for pull request finding
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
1 parent 14edc9f commit b0aa5f9

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/mistapi/websockets/__ws_client.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,11 @@ def _run_forever_safe(self) -> None:
250250
if self._user_disconnect.wait(timeout=delay):
251251
break # disconnect() called during backoff
252252

253+
# Guard against a disconnect that happens immediately after the
254+
# backoff wait returns but before creating a new WebSocketApp.
255+
if self._user_disconnect.is_set():
256+
break
257+
253258
self._ws = self._create_ws_app()
254259

255260
# Final close: put sentinel and call callback

0 commit comments

Comments
 (0)