feat!: Add a start wait time option for initialization - #66
Draft
kinyoklion wants to merge 2 commits into
Draft
kinyoklion wants to merge 2 commits into
kinyoklion wants to merge 2 commits into
Conversation
Fixes #58 Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Draft
3 tasks
Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
3 tasks
Contributor
|
@cursor review |
This branch has not been deployed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Requirements
Related issues
Fixes #58.
Describe the solution you've provided
Adds
Provider(String sdkKey, LDConfig config, Duration startWait)so an application can bound, or deliberately opt out of, waiting for initialization, matching the OpenFeature provider spec (OFP) requirements for start wait behavior:Durationis applied by the LaunchDarkly client constructor, andinitializethen reports whether the client became ready without waiting a second timeDuration.ZEROwaits nowhere;initializefails unless the client is already ready, and the application learns when it becomes usable from provider eventsnullrequests indefinite waiting: nothing is waited for during construction andinitializeblocks until the data source becomes valid or fails permanentlyThe existing constructors keep honouring
LDConfig.Builder.startWait(...)and no longer wait again ininitialize, so a configured start wait is the only bound on initialization instead of being followed by an unbounded wait. The README feature matrix row and initialization section describe the new behavior.Implementation details
initializestill registers data source and flag change listeners and evaluates the current data source status. Only the indefinite mode leaves the completion future pending; every other mode completes it with the outcome that is already known, soinitializereturns promptly. Status reporting after a failed initialization is unchanged.Describe alternatives you've considered
Keeping the existing indefinite wait and adding a timeout parameter interpreted only inside
initializewould double-wait whenLDConfig.startWaitis also set, and would not match OFP, which treats the start wait as a bound over construction plus initialization.Additional context
Sibling changes for the same OFP requirement: launchdarkly/openfeature-python-server#64, launchdarkly/openfeature-ruby-server#36, launchdarkly/openfeature-dotnet-server#71, and launchdarkly/js-core#2024.
Verified with
./gradlew test(all tests pass, including new coverage for positive, zero, and indefinite start wait).Link to Devin session: https://app.devin.ai/sessions/1fd3fcbfe79f482e8b58be29e8df2ffb
Open in Devin Desktop: https://app.devin.ai/desktop/session/1fd3fcbfe79f482e8b58be29e8df2ffb?variant=devin
Requested by: @kinyoklion