Repository navigation
feat: send periodic SSE heartbeats to reap half-open connections - #50
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #50 +/- ##
===========================================
Coverage 100.00% 100.00%
Complexity 165 165
===========================================
Files 27 27
Lines 437 443 +6
===========================================
+ Hits 437 443 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
bpolaszek
approved these changes
Jul 3, 2026
Owner
|
👌 |
Closed
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.
Idle SSE subscribers whose client dies silently (mobile drop, laptop sleep, NAT/proxy timeout) never emit a stream
close, so they leak in the transport's topic index (~kernel keepalive, ~2h) and keep getting re-matched on every publish, wasting CPU.This adds a periodic SSE heartbeat (
:\nSSE comment) per subscription. It (a) keeps live connections open through reverse-proxy idle timeouts and (b) forces a TCP write on half-open peers so the kernel detects the dead connection and emitsclose, triggering the existing unsubscribe path.heartbeat_intervalhub option (default 40s), configurable viaHEARTBEAT_INTERVALenv;0disables.