fix(services): Resolve Redis timeouts and suspend degraded ServX polling - #47
Merged
Conversation
…ling when backend is unreachable
|
Unable to deploy a commit from a private repository on your GitHub organization to the Chitkul Lakshya's projects team on Vercel, which is currently on the Hobby plan. In order to deploy, you can:
To read more about collaboration on Vercel, click here. |
There was a problem hiding this comment.
Pull request overview
Stability-focused changes intended to (1) reduce Redis connection timeout failures in the API layer and (2) prevent excessive client-side polling/log spam by suspending ServX status polling when the backend is unreachable.
Changes:
- Increased the Redis connect Promise.race timeout from 1s to 5s.
- Updated
ServXProviderpolling to clear the polling interval when a fetch failure indicates the backend is unreachable.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/react/src/ServXProvider.tsx | Suspends client polling on “backend unreachable” fetch failures to reduce warning spam. |
| apps/api/src/core/services/redisCache.ts | Extends the Redis connect race timeout window from 1s to 5s. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+72
to
+76
| } catch (err: any) { | ||
| // Silently fail in production to avoid crashing user applications | ||
| // if the ServX network is experiencing latency. | ||
| console.warn('[ServX] Polling sync degraded, maintaining previous operational state.'); | ||
| if (err.name === 'TypeError' && err.message === 'Failed to fetch') { | ||
| // Stop polling if the server is completely unreachable (e.g. localhost down) |
Comment on lines
66
to
70
| const connectPromise = client.connect(); | ||
| const timeoutPromise = new Promise((_, reject) => | ||
| setTimeout(() => reject(new Error('Redis connection timeout')), 1000) | ||
| setTimeout(() => reject(new Error('Redis connection timeout')), 5000) | ||
| ); | ||
| await Promise.race([connectPromise, timeoutPromise]); |
Comment on lines
66
to
71
| const connectPromise = client.connect(); | ||
| const timeoutPromise = new Promise((_, reject) => | ||
| setTimeout(() => reject(new Error('Redis connection timeout')), 1000) | ||
| setTimeout(() => reject(new Error('Redis connection timeout')), 5000) | ||
| ); | ||
| await Promise.race([connectPromise, timeoutPromise]); | ||
| return client; |
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.
This pull request contains stability fixes to resolve Redis connection timeouts and suspend ServX polling when the backend is unreachable. Detailed changes: