Skip to content

Commit b6ee33e

Browse files
Prevent multiple tasks for reconnection (miguelgrinberg#1369)
* Prevent multiple taks for reconnection As discussed here. miguelgrinberg#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 <humayun.ajmal@strikeready.com> * async client --------- Signed-off-by: Humayun Ajmal <humayun.ajmal@strikeready.com> Co-authored-by: Miguel Grinberg <miguel.grinberg@gmail.com>
1 parent 78d1124 commit b6ee33e

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/socketio/async_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -581,7 +581,7 @@ async def _handle_eio_disconnect(self):
581581
self.callbacks = {}
582582
self._binary_packet = None
583583
self.sid = None
584-
if will_reconnect:
584+
if will_reconnect and not self._reconnect_task:
585585
self._reconnect_task = self.start_background_task(
586586
self._handle_reconnect)
587587

src/socketio/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -539,7 +539,7 @@ def _handle_eio_disconnect(self):
539539
self.callbacks = {}
540540
self._binary_packet = None
541541
self.sid = None
542-
if will_reconnect:
542+
if will_reconnect and not self._reconnect_task:
543543
self._reconnect_task = self.start_background_task(
544544
self._handle_reconnect)
545545

0 commit comments

Comments
 (0)