Added Auto Ping after interval and ping timeout for improved stability#674
Open
Added Auto Ping after interval and ping timeout for improved stability#674
Conversation
…er` to improve connection stability.
Collaborator
Author
📚
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR Type
Feature
PR Checklist
Overview
This change introduces automatic WebSocket ping mechanisms within the
run_ws_threadfunction inlive_log_service.pyto enhance connection stability for nodes that might experience long periods of inactivity or network fluctuations.Previously, the
run_forevermethod for the WebSocket connection lacked explicit heartbeat mechanisms, which could lead to connections timing out silently or becoming stale without proper re-establishment, resulting in service disruption.This PR configures
next_ws.run_forever()to includeping_interval=15seconds andping_timeout=10seconds. This mandates that a ping frame is sent every 15 seconds, and if a pong is not received within 10 seconds, the connection will be closed and a reconnection attempt initiated. This proactive monitoring improves the resilience against dropped connections managed by intermediary proxies or load balancers, leading to improved stability for frequently connecting/disconnecting scenarios.No breaking changes are introduced; this is an enhancement to the underlying WebSocket management logic.
Test Cases