-
Notifications
You must be signed in to change notification settings - Fork 68
fix(flagd): configurable retry backoff after each sync cycle error (#756) #806
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?
fix(flagd): configurable retry backoff after each sync cycle error (#756) #806
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
4762cab to
9903081
Compare
Signed-off-by: Alexandra Oberaigner <[email protected]>
Signed-off-by: Alexandra Oberaigner <[email protected]>
Signed-off-by: Alexandra Oberaigner <[email protected]>
Signed-off-by: Alexandra Oberaigner <[email protected]>
…t behaviour to Java flagd provider Signed-off-by: Alexandra Oberaigner <[email protected]>
Signed-off-by: Alexandra Oberaigner <[email protected]>
9903081 to
dc1cf05
Compare
aepfli
left a comment
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.
I am still not the biggest fan of a sleep, as this will block everything. even if do some kind of context cancellation and want to stop execution. we are stopped by a pretty long Sleep. Hence i think we should really try to use a different construct than a sleep.
The rest of the pull request looks good to me, and is ready to merge.
Disclaimer: For me the sleep is a reason to not approving this, but not a big enough reason to block this pull request from getting merged, if the rest of the approvers are fine with this.
Signed-off-by: Alexandra Oberaigner <[email protected]>
| } | ||
|
|
||
| // WithRetryBackoffMs sets the initial backoff duration (in milliseconds) for retrying failed connections | ||
| func WithRetryBackoffMs(retryBackoffMs int) ProviderOption { |
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.
A parameter that represents a duration should be of type time.Duration. The name of the parameter should be changed to remove any reference to a specific unit like milliseconds.
| } | ||
| } | ||
|
|
||
| cfg.RetryGracePeriod = getIntFromEnvVarOrDefault(flagdGracePeriodVariableName, defaultGracePeriod, cfg.log) |
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.
Use time.ParseDuration to parse durations.
Ya, personally I'm fine with it. We already have the same pattern in Java, so I would go with it for now. This sleep is only during what's already an unusual error scenario (connection is healthy, but stream keeps returning errors immediately), within a retry loop, so I think it's acceptable.... but looks like @alexandraoberaigner already used a timer. |
toddbaert
left a comment
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.
I added a recommended comment for why we are doing our own weird simple backoff for unusual situations. I also agree with @sahidvelji 's duration comment.
Otherwise LGTM.
Co-authored-by: Todd Baert <[email protected]> Signed-off-by: alexandraoberaigner <[email protected]>
This PR
adds configurable retry backoff options to the flagd in-process provider, which allows to configure the retry policy of gRPC connections.
Aims to make the implementation consistent with Java. See this change to prevent tight loops when the retry policy doesn't take effect
Related Issues
Details
Configuration and API Enhancements:
RetryBackoffMsandRetryBackoffMaxMstoProviderConfiguration, with corresponding default values, environment variable support, and provider options (WithRetryBackoffMs,WithRetryBackoffMaxMs). These allow users to configure retry backoff durations for connection retries. [1] [2] [3] [4] [5] [6]Retry Logic and Policy:
InitialBackoffandMaxBackoffinstead of hardcoded durations, making retry behavior fully configurable.Testing and Validation:
TestBuildRetryPolicy) for the retry policy builder, verifying that the generated JSON policy reflects the configured backoff values and other retry parameters.