Skip to content

Commit

Permalink
Merge pull request #1 from lynxal/SipanOhanyan-patch-1
Browse files Browse the repository at this point in the history
Fixing problem with infinite connecting threads
  • Loading branch information
SipanOhanyan authored Nov 13, 2024
2 parents bc4ade2 + 16fa5af commit 27bcc59
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions signalrcore/transport/websockets/websocket_transport.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,17 +227,15 @@ def handle_reconnect(self):
except Exception as ex:
self.logger.error(ex)
sleep_time = self.reconnection_handler.next()
threading.Thread(
target=self.deferred_reconnect,
args=(sleep_time,)
).start()
self.deferred_reconnect(sleep_time)

def deferred_reconnect(self, sleep_time):
time.sleep(sleep_time)
try:
if not self.connection_alive:
self.send(PingMessage())
if not self.connection_checker.running:
self.send(PingMessage())
except Exception as ex:
self.logger.error(ex)
self.reconnection_handler.reconnecting = False
self.connection_alive = False
self.connection_alive = False

0 comments on commit 27bcc59

Please sign in to comment.