Browse Source

Prevent multiple taks for reconnection

As discussed here.

https://github.com/miguelgrinberg/python-socketio/discussions/1367

In certain scenarios, this library creates multiple reconnection tasks.

A check is added to make sure that reconnection task starts only when

this task is not running.

Signed-off-by: Humayun Ajmal <[email protected]>
pull/1369/head
Humayun Ajmal 9 months ago
parent
commit
5da3e3bd06
  1. 2
      src/socketio/client.py

2
src/socketio/client.py

@ -534,7 +534,7 @@ class Client(base_client.BaseClient):
self.callbacks = {}
self._binary_packet = None
self.sid = None
if will_reconnect:
if will_reconnect and not self._reconnect_task:
self._reconnect_task = self.start_background_task(
self._handle_reconnect)

Loading…
Cancel
Save