Skip to content

Conversation

@sallem-consensys
Copy link

@sallem-consensys sallem-consensys commented Oct 23, 2025

Explanation

This PR pushes for a retry to be called an exponential backoff by the minute. The remote feature flag controller will automatically:
Make an initial API request
If it fails, wait 1 minute and retry
If that fails, wait 2 minutes and retry
If that fails, wait 4 minutes and retry
After 3 failed retries (4 total attempts), the circuit breaker will prevent further attempts for a period.

References

Checklist

  • I've updated the test suite for new or updated code as appropriate
  • I've updated documentation (JSDoc, Markdown, etc.) for new or updated code as appropriate
  • [X I've communicated my changes to consumers by updating changelogs for packages I've changed, highlighting breaking changes as necessary
  • I've prepared draft pull requests for clients and consumer packages to resolve any breaking changes

Note

Adds optional per-retry custom backoff intervals to ClientConfigApiService with validation and tests; defaults to exponential backoff when not provided.

  • ClientConfig API Service (src/client-config-api-service/client-config-api-service.ts)
    • Add optional customBackoffInterval (seconds) to constructor for precise per-retry delays.
    • Implement CustomIntervalBackoff and integrate via createServicePolicy({ backoff }).
    • Validate intervals (non-empty, positive numbers, length equals retries); throw descriptive errors.
    • Default to ExponentialBackoff when no custom intervals are provided.
    • Minor: make several private fields readonly; JSDoc improvements.
  • Tests (client-config-api-service.test.ts)
    • Add coverage for custom intervals usage, validation errors, and fallback to exponential backoff.
    • Utility createMockFetch defaults and behavior adjusted for tests.
  • Controller (src/remote-feature-flag-controller.ts)
    • Minor: mark fields readonly; comment cleanups.
  • Changelog
    • Document custom backoff interval support and defaults.

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

@sallem-consensys sallem-consensys requested review from a team as code owners October 23, 2025 01:41
cursor[bot]

This comment was marked as outdated.

@sallem-consensys sallem-consensys force-pushed the feat/create-minute-exponential-backoff branch from 99c4e1c to 67461df Compare October 23, 2025 11:21
*
* @returns A Cockatiel ExponentialBackoff instance configured for minute-based intervals.
*/
function createMinuteBasedExponentialBackoff() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider adding this as an argument to the constructor apply the existing default values. This show allow backwards compatibility and customization for the mobile client.

return nextBackoff.next();
},
};
}
Copy link

Choose a reason for hiding this comment

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

Bug: Backoff Method Errors Lead to Malfunction

The CustomIntervalBackoff.next() method has two issues. It can return an undefined duration if currentIndex exceeds the intervals array bounds, potentially causing retry policy malfunctions. Additionally, it incorrectly calls nextBackoff.next() recursively instead of returning the nextBackoff instance directly, which could lead to infinite recursion or incorrect backoff progression.

Fix in Cursor Fix in Web

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