Browse Source

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
pull/1407/head
Arseny 5 months ago
committed by GitHub
parent
commit
f4224a6766
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 2
      src/socketio/async_client.py

2
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':

Loading…
Cancel
Save