Skip to content

Commit f4224a6

Browse files
authored
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
1 parent 72d37ea commit f4224a6

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/socketio/async_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ async def wait(self):
188188
while True:
189189
await self.eio.wait()
190190
await self.sleep(1) # give the reconnect task time to start up
191-
if not self._reconnect_task:
191+
if not self._reconnect_task and self.eio.state != 'connected':
192192
break
193193
await self._reconnect_task
194194
if self.eio.state != 'connected':

0 commit comments

Comments
 (0)