fix(ui): add retry logic to SSE pong to improve connection resilience#519
Open
JDis03 wants to merge 1 commit into
Open
fix(ui): add retry logic to SSE pong to improve connection resilience#519JDis03 wants to merge 1 commit into
JDis03 wants to merge 1 commit into
Conversation
When the client receives a ping from the server, it responds with a pong via HTTP POST. On unstable networks (mobile, WiFi with poor signal, network switches), this POST can fail due to transient errors: - Network timeouts - Brief disconnections - Server temporarily unavailable Previously, a single pong failure would cause the server to close the SSE connection after 45s timeout, leaving message responses stuck in queue until the next message triggered a reconnection. This fix wraps the pong POST in retryWithBackoff with exponential backoff: - 3 attempts maximum - 100ms initial delay, doubling each retry - 2000ms maximum delay between retries This handles transient network issues gracefully without requiring reconnection, improving message delivery reliability for all users on imperfect networks (not just mobile). Retry logic is extracted to a reusable retry-utils.ts module that can be used for other fragile HTTP operations in the future.
|
PR builds are available as GitHub Actions artifacts: https://github.com/NeuralNomadsAI/CodeNomad/actions/runs/26818019424 Artifacts expire in 7 days.
|
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.
Problem
When the client receives a ping from the server, it responds with a pong via HTTP POST. On unstable networks (mobile, WiFi with poor signal, network switches), this POST can fail due to transient errors:
Previously, a single pong failure would cause the server to close the SSE connection after 45s timeout, leaving message responses stuck in queue until the next message triggered a reconnection.
Solution
This fix wraps the pong POST in retryWithBackoff with exponential backoff:
This handles transient network issues gracefully without requiring reconnection, improving message delivery reliability for all users on imperfect networks (not just mobile).
Changes
Testing
npm run build:uiBenefits