Skip to content

Add heartbeat monitoring and auto-reconnect#635

Open
gijzelaerr wants to merge 1 commit intomasterfrom
feature/heartbeat-reconnect
Open

Add heartbeat monitoring and auto-reconnect#635
gijzelaerr wants to merge 1 commit intomasterfrom
feature/heartbeat-reconnect

Conversation

@gijzelaerr
Copy link
Owner

Summary

  • Adds configurable heartbeat probing via background daemon thread
  • Adds automatic reconnection with exponential backoff and jitter
  • Supports on_disconnect and on_reconnect callbacks
  • Thread-safe reconnection with locking
  • is_alive property for connection health monitoring
  • Fully backward compatible — all new parameters are keyword-only with defaults that preserve existing behavior

Closes #626, closes #627

Test plan

  • 20 tests pass (tests/test_reconnect.py)
  • Tests cover: defaults, reconnect on read/write failure, callbacks, max retries exhausted, heartbeat start/stop, alive/dead detection, backward compatibility
  • mypy strict mode passes
  • ruff check/format passes

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.6 noreply@anthropic.com

Adds configurable heartbeat probing, automatic reconnection with
exponential backoff and jitter, and disconnect/reconnect callbacks.
Closes #626, closes #627

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@gijzelaerr gijzelaerr force-pushed the feature/heartbeat-reconnect branch from ce13f3a to 8d3c2e4 Compare March 20, 2026 10:49
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.

Connection watchdog / heartbeat Automatic reconnection with configurable retry/backoff

1 participant