Skip to content

fix(services): Resolve Redis timeouts and suspend degraded ServX polling - #47

Merged
ChitkulLakshya merged 1 commit into
mainfrom
fix/redis-servx-polling
Jul 2, 2026
Merged

fix(services): Resolve Redis timeouts and suspend degraded ServX polling#47
ChitkulLakshya merged 1 commit into
mainfrom
fix/redis-servx-polling

Conversation

@ChitkulLakshya

Copy link
Copy Markdown
Member

This pull request contains stability fixes to resolve Redis connection timeouts and suspend ServX polling when the backend is unreachable. Detailed changes:

  • Increased Redis connection timeout limit to 5 seconds to reduce connection timeout failures.
  • Updated ServXProvider to suspended polling if the server becomes completely unreachable, preventing excessive console warning spam.

Copilot AI review requested due to automatic review settings July 2, 2026 09:14
@vercel

vercel Bot commented Jul 2, 2026

Copy link
Copy Markdown

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:

  • Make your repository public or
  • Upgrade to Pro. A Pro subscription is required to deploy from a private organization repository.

To read more about collaboration on Vercel, click here.

@ChitkulLakshya
ChitkulLakshya merged commit 26161eb into main Jul 2, 2026
1 check failed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ServXProvider polling 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;
@prem22k
prem22k deleted the fix/redis-servx-polling branch July 3, 2026 11:39
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.

2 participants