Skip to content

Conversation

@luismeyer
Copy link
Member

Implements automatic retry logic with exponential backoff when the flag network stream unexpectedly closes. The stream will retry with delays increasing from 1s to a maximum of 30s, allowing the datasource to recover from temporary network issues while falling back to bundled definitions if initial connection fails.

Changes:

  • Added exponential backoff retry mechanism (1s → 2s → 4s → 8s → 16s → 30s max)
  • Distinguishes between initial connection failures and mid-stream closures
  • Automatically retries on stream closure without user intervention
  • Adds shutdown() method to cleanly stop the retry loop

Behavior:

  • Initial connection failures propagate errors for fallback to bundled definitions
  • Stream closures trigger automatic retries with exponential backoff
  • Retry count resets on successful connection

vercel bot and others added 3 commits December 12, 2025 07:20
Updated dependencies to fix Next.js and React CVE vulnerabilities.

The fix-react2shell-next tool automatically updated the following packages to their secure versions:
- next
- react-server-dom-webpack
- react-server-dom-parcel  
- react-server-dom-turbopack

All package.json files have been scanned and vulnerable versions have been patched to the correct fixed versions based on the official React advisory.

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Implements automatic retry logic with exponential backoff when the flag network
stream unexpectedly closes. The stream will retry with delays increasing from
1s to a maximum of 30s, allowing the datasource to recover from temporary
network issues while falling back to bundled definitions if initial connection
fails.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>
@vercel
Copy link
Contributor

vercel bot commented Jan 20, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
flags Error Error Jan 20, 2026 9:58am
flags-sdk-next-15 Ready Ready Preview, Comment Jan 20, 2026 9:58am
flags-sdk-next-16 Ready Ready Preview, Comment Jan 20, 2026 9:58am
flags-sdk-snippets Ready Ready Preview, Comment Jan 20, 2026 9:58am
flags-sdk-sveltekit-snippets Ready Ready Preview, Comment Jan 20, 2026 9:58am
flags-sdk-vercel-flag-network Ready Ready Preview, Comment Jan 20, 2026 9:58am
shirt-shop Ready Ready Preview, Comment Jan 20, 2026 9:58am
shirt-shop-api Ready Ready Preview, Comment Jan 20, 2026 9:58am

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
private hasReceivedData: boolean = false;
private retryCount: number = 0;
private readonly maxRetryDelay: number = 30000; // 30 seconds max delay
private readonly baseRetryDelay: number = 1000; // 1 second initial delay
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we retry once immediately?

let eventData: string | null = null;
while (!this.breakLoop) {
try {
console.log(process.pid, 'createLoop → MAKE STREAM');
Copy link
Collaborator

Choose a reason for hiding this comment

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

leftover?

@luismeyer luismeyer marked this pull request as ready for review January 20, 2026 12:09
@luismeyer luismeyer merged commit 9031289 into flag-network Jan 20, 2026
10 of 11 checks passed
@luismeyer luismeyer deleted the luismeyer/flag-network-retries branch January 20, 2026 12:09
dferber90 pushed a commit that referenced this pull request Jan 24, 2026
* Fix React Server Components CVE vulnerabilities (#235)

Updated dependencies to fix Next.js and React CVE vulnerabilities.

The fix-react2shell-next tool automatically updated the following packages to their secure versions:
- next
- react-server-dom-webpack
- react-server-dom-parcel  
- react-server-dom-turbopack

All package.json files have been scanned and vulnerable versions have been patched to the correct fixed versions based on the official React advisory.

Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>

* Add retries to flag network datasource when stream closes

Implements automatic retry logic with exponential backoff when the flag network
stream unexpectedly closes. The stream will retry with delays increasing from
1s to a maximum of 30s, allowing the datasource to recover from temporary
network issues while falling back to bundled definitions if initial connection
fails.

Co-Authored-By: Claude Haiku 4.5 <noreply@anthropic.com>

* Revert package.json and pnpm-lock changes

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Co-authored-by: Vercel <vercel[bot]@users.noreply.github.com>
Co-authored-by: Claude Haiku 4.5 <noreply@anthropic.com>
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.

3 participants