From f4224a6766f0354a9dc4804bf23093cff4ebc1f0 Mon Sep 17 00:00:00 2001 From: Arseny <36441601+arkuzo@users.noreply.github.com> Date: Tue, 19 Nov 2024 11:45:13 +0300 Subject: [PATCH] fix AsyncClient::wait unexpected return after success reconnect AsyncClient::wait use sleep(1) call to wait to start reconnect task. Sometimes reconnect is faster then 1 second, and wait returns while connection to server is established. Added one check to avoid this situation --- src/socketio/async_client.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/socketio/async_client.py b/src/socketio/async_client.py index e79fce0..4869dfa 100644 --- a/src/socketio/async_client.py +++ b/src/socketio/async_client.py @@ -188,7 +188,7 @@ class AsyncClient(base_client.BaseClient): while True: await self.eio.wait() await self.sleep(1) # give the reconnect task time to start up - if not self._reconnect_task: + if not self._reconnect_task and self.eio.state != 'connected': break await self._reconnect_task if self.eio.state != 'connected':