Skip to content

Added Auto Ping after interval and ping timeout for improved stability#674

Open
mahbd wants to merge 1 commit intodevfrom
node-frequently-connecting-disconnecting-log
Open

Added Auto Ping after interval and ping timeout for improved stability#674
mahbd wants to merge 1 commit intodevfrom
node-frequently-connecting-disconnecting-log

Conversation

@mahbd
Copy link
Collaborator

@mahbd mahbd commented Mar 9, 2026

PR Type

Feature

PR Checklist

  • Tests for the changes have been added / updated.
  • Documentation comments have been added / updated.
  • A changelog entry has been made.
  • Version number has been updated.
  • Required modules have been added to respective "requirements*.txt" files.
  • Relevant Test Cases added to this description (below).
  • (Team) Label with affected action categories and semver status.

Overview

This change introduces automatic WebSocket ping mechanisms within the run_ws_thread function in live_log_service.py to enhance connection stability for nodes that might experience long periods of inactivity or network fluctuations.

Previously, the run_forever method 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 include ping_interval=15 seconds and ping_timeout=10 seconds. 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

@mahbd
Copy link
Collaborator Author

mahbd commented Mar 9, 2026

📚 $\text{Stack Overview}$

Pulls submitted in this stack:

This comment was automatically generated by st.

@mahbd mahbd marked this pull request as ready for review March 9, 2026 02:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant