-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: client init state should not regress when data source interrupted (
#441) The contract of `Initialized()` is that it's supposed to return true forever once the client has received some data from LaunchDarkly. This wasn't correct because `Initialized()` was delegating to `IsInitializedSuccessfully()`. This function returned true only for the `Valid` and `Offline` states. This is missing `Interrupted`, which the SDK might be in after having once been `Valid`. -------------------------- Besides causing an incorrect result for `Initialized()` when the SDK's data source was interrupted, this affected logging when calling an evaluation method, emitting an incorrect message : > LaunchDarkly client has not yet been initialized. Returning cached value Although the action is correct (`returning cached value`), the reason (`has not yet initialized`) is wrong. We don't need to log this message at all as an interrupted SDK is normal. To fix, I've deleted the confusing internal `IsInitialized` method, which was really a proxy for checking `state != initializing`. I've modified `IsInitializedSuccessfully` to return true for `Interrupted`.
- Loading branch information
1 parent
23625ca
commit 4a7f1f9
Showing
3 changed files
with
33 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters