-
-
Notifications
You must be signed in to change notification settings - Fork 252
Feat/create minute exponential backoff #6922
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
99c4e1c to
67461df
Compare
| * | ||
| * @returns A Cockatiel ExponentialBackoff instance configured for minute-based intervals. | ||
| */ | ||
| function createMinuteBasedExponentialBackoff() { |
There was a problem hiding this comment.
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(); | ||
| }, | ||
| }; | ||
| } |
There was a problem hiding this comment.
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.
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
Note
Adds optional per-retry custom backoff intervals to
ClientConfigApiServicewith validation and tests; defaults to exponential backoff when not provided.src/client-config-api-service/client-config-api-service.ts)customBackoffInterval(seconds) to constructor for precise per-retry delays.CustomIntervalBackoffand integrate viacreateServicePolicy({ backoff }).retries); throw descriptive errors.ExponentialBackoffwhen no custom intervals are provided.readonly; JSDoc improvements.client-config-api-service.test.ts)createMockFetchdefaults and behavior adjusted for tests.src/remote-feature-flag-controller.ts)readonly; comment cleanups.Written by Cursor Bugbot for commit 7d074ed. This will update automatically on new commits. Configure here.