Skip to content

feat: add retry logic to FDv2 polling initializer#1230

Merged
kinyoklion merged 4 commits intomainfrom
rlamb/polling-initializer-retries
Mar 30, 2026
Merged

feat: add retry logic to FDv2 polling initializer#1230
kinyoklion merged 4 commits intomainfrom
rlamb/polling-initializer-retries

Conversation

@kinyoklion
Copy link
Copy Markdown
Member

@kinyoklion kinyoklion commented Mar 27, 2026

Summary

  • The FDv2 polling initializer now retries up to 3 times on recoverable errors (5xx, 400, 408, 429, network errors) with a 1-second delay between attempts, matching FDv1 behavior
  • Uses a SHUTDOWN symbol for clean race discrimination between poll results and shutdown signals
  • Removes the oneShot parameter from poll() / processEvents() since retry logic now lives at the initializer level

Note

Medium Risk
Medium risk because it changes FDv2 initialization behavior by adding retry/delay loops and altering how polling errors are classified, which can affect startup latency and failure modes.

Overview
Adds retry behavior to the FDv2 polling initializer: it now retries up to 3 times with a 1s delay on recoverable interrupted results, converts an exhausted retry sequence into terminal_error, and supports shutdown during both an in-flight poll and the retry sleep via a sentinel SHUTDOWN symbol.

Simplifies fdv2 polling by removing the oneShot/initializer-mode branching from PollingBase/processEvents and updating all call sites/tests accordingly (including SourceFactoryProvider ping handling and browser test mocks to return FDv2-style poll responses).

Written by Cursor Bugbot for commit 1dd4150. This will update automatically on new commits. Configure here.

The polling initializer now retries up to 3 times on recoverable errors
with a 1-second delay between attempts, matching the FDv1 behavior.

Removes the oneShot parameter from poll() since the initializer was its
only consumer and retry logic now handles error classification at the
initializer level.
@github-actions
Copy link
Copy Markdown
Contributor

@launchdarkly/js-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 25661 bytes
Compressed size limit: 29000
Uncompressed size: 126143 bytes

@github-actions
Copy link
Copy Markdown
Contributor

@launchdarkly/browser size report
This is the brotli compressed size of the ESM build.
Compressed size: 179253 bytes
Compressed size limit: 200000
Uncompressed size: 828804 bytes

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Mar 27, 2026

@launchdarkly/js-client-sdk-common size report
This is the brotli compressed size of the ESM build.
Compressed size: 37015 bytes
Compressed size limit: 38000
Uncompressed size: 202741 bytes

The mock fetch headers.get() returned undefined instead of null,
causing a TypeError in getFallback() that triggered retries.
Also adds a valid FDv2 response for /sdk/poll/eval URLs.
@github-actions
Copy link
Copy Markdown
Contributor

@launchdarkly/js-client-sdk size report
This is the brotli compressed size of the ESM build.
Compressed size: 31446 bytes
Compressed size limit: 34000
Uncompressed size: 111621 bytes

@kinyoklion
Copy link
Copy Markdown
Member Author

bugbot review

Copy link
Copy Markdown

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

@kinyoklion kinyoklion marked this pull request as ready for review March 27, 2026 21:46
@kinyoklion kinyoklion requested a review from a team as a code owner March 27, 2026 21:46
@kinyoklion kinyoklion merged commit fe8bd37 into main Mar 30, 2026
45 checks passed
@kinyoklion kinyoklion deleted the rlamb/polling-initializer-retries branch March 30, 2026 16:19
@github-actions github-actions bot mentioned this pull request Mar 30, 2026
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