-
Notifications
You must be signed in to change notification settings - Fork 487
adapter: properly retry when LD client initialization fails #32030
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
| if tokio::time::timeout(config_sync_timeout, init) | ||
| .await | ||
| .is_err() |
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.
The timeout error handling here also looks very suspicious to me. We just log an INFO event, but the LD sync might be broken. Shouldn't we at least return an error?
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.
+1 it should be an error
Previously the code initializing the LD client would correctly await `initialized_async` to see if the initialization succeeded. However, if it didn't succeed it would simply wait a bit and then call `initialized_async` again. Reading the LD server sdk code, there is no reason to assume that the call would return something different if repeated. This commit changes the logic to call `start_with_default_executor` again when `initialized_async` reports failure, to attempt a new initialization. It also moves to the mz-ore `Retry` type, instead of implementing manual retry logic.
ParkMyCar
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.
Sorry for the delay on this one @teskje, thanks for making the change though!
| if tokio::time::timeout(config_sync_timeout, init) | ||
| .await | ||
| .is_err() |
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.
+1 it should be an error
Previously the code initializing the LD client would correctly await
initialized_asyncto see if the initialization succeeded. However, if it didn't succeed it would simply wait a bit and then callinitialized_asyncagain. Reading the LD server sdk code, there is no reason to assume that the call would return something different if repeated.This PR changes the logic to call
start_with_default_executoragain wheninitialized_asyncreports failure, to attempt a new initialization. It also moves to the mz-oreRetrytype, instead of implementing manual retry logic.Motivation
If initializing the LD client fails the first time, the code gets stuck forever in a retry loop.
Tips for reviewer
I only stumbled over this when reading the code and I might be missing something. Please check my work!
Checklist
$T ⇔ Proto$Tmapping (possibly in a backwards-incompatible way), then it is tagged with aT-protolabel.