fix(flagd): do not retry for certain status codes (#756)#799
Conversation
a2312a3 to
a25f7be
Compare
|
As we are adding new config options, we should wait for open-feature/flagd-testbed#311 to be merged to ensure property names are in consistent for all the providers based on the docs. |
3035374 to
c8e8e10
Compare
This comment was marked as resolved.
This comment was marked as resolved.
i am not sure, but worst case the how-to-fix section in https://github.com/open-feature/go-sdk-contrib/pull/799/checks?check_run_id=56445883813 can be helpful and should fix this ;) |
bf2e6f2 to
56800b2
Compare
aepfli
left a comment
There was a problem hiding this comment.
I think this pullrequest merges two features, fatalErrorCodes and backoff - to keep the changes distinct i suggest separating them into two different pull requests (does not mean they will not be released within one changeset) as they can be also delivered separately.
Furthermore we should rethink our sleeps as I think this is not good practice and there are alternatives, I also created an improvement for the java provider for this.
| } | ||
|
|
||
| // Backoff before retrying | ||
| time.Sleep(time.Duration(g.RetryBackOffMaxMs) * time.Millisecond) |
There was a problem hiding this comment.
I am not a big fan of our blocking sleeps, as they clearly have some disadvantages, should we maybe stick to a timer for this kind of logic? like
select {
case <-time.After(time.Duration(g.RetryBackOffMaxMs) * time.Millisecond):
// ... code here ...
case <-ctx.Done():
return // Allows cancellation
}There was a problem hiding this comment.
There's disadvantages of sleep, but I think right now this is better than nothing, because nothing == a tight loop in some cases that is a serious bug in some situations.
Pls consider my comment above :)
We can do an improvement issue for golang too -> this is just a bug fix / consistency PR |
toddbaert
left a comment
There was a problem hiding this comment.
This implementation looks good to me, nice work overall. One thing I think we need in addition is that we should use the same FATAL codes in RPC mode - so I think you will have to add something similar to what you have done in pkg/service/rpc/service.go... do you agree? Since both modes have streams, I think it makes sense for both streams to use this rule.
With respect to @aepfli and @guidobrei 's comment about separating things... I can go either way, but you will need 1 more approval besides mine and I think it might make it easier for you to debug the e2e CI failure.
Signed-off-by: Alexandra Oberaigner <alexandra.oberaigner@dynatrace.com>
7ab3ce0 to
8ff44da
Compare
aepfli
left a comment
There was a problem hiding this comment.
thank you, looks good to me, one little nit, but nothing blocking this pr from getting merged
Signed-off-by: Alexandra Oberaigner <alexandra.oberaigner@dynatrace.com>
12b55af to
f531ab0
Compare
|
[Q] does someone have an idea why the gherkin tests for SYNC_PORT still fail even though I excluded them with ~@sync-port |
Signed-off-by: Alexandra Oberaigner <alexandra.oberaigner@dynatrace.com>
Signed-off-by: Todd Baert <todd.baert@dynatrace.com>
6e45d12 to
7d6fff6
Compare
@alexandraoberaigner I pushed this. |
Signed-off-by: Alexandra Oberaigner <alexandra.oberaigner@dynatrace.com>
|
the retryBackoff changes have been removed from this PR as suggested by @guidobrei @aepfli - I will open a separate PR soon |
|
I'll merge tomorrow unless I hear objections cc @guidobrei |
This PR
This pull request introduces configurable retry and fatal error handling for the in-process gRPC sync provider in the
flagdproject. The main changes include adding new configuration options for retry backoff timing and fatal status codes, refactoring environment variable parsing, and updating service initialization and error handling logic.Related Issues
Changes
Retry and fatal error configuration (most important):
RetryBackoffMs,RetryBackoffMaxMs,FatalStatusCodes) toProviderConfiguration, with environment variable support and helper functions for parsing integer values from environment variables. [1] [2] [3] [4] [5] [6]Refactoring and code quality:
grpc_config.go, making the code more modular and testable. [1] [2] [3] [4] [5]Error handling improvements:
grpc_config_test.go.