fix: Resolve initialization immediately when a start wait time was used - #66
Open
kinyoklion wants to merge 1 commit into
Open
fix: Resolve initialization immediately when a start wait time was used#66kinyoklion wants to merge 1 commit into
kinyoklion wants to merge 1 commit into
Conversation
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:
|
Contributor
|
@cursor review |
kinyoklion
marked this pull request as ready for review
August 31, 2026 21:16
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.
A positive
StartWaitTimeno longer causes a second wait during provider initialization.LdClientconstructor for the start wait time, soInitializeAsyncnow completes with the outcome instead of scheduling its own timer; a 5 second start wait no longer means up to 10 seconds beforeSetProviderAsyncresolves.StartWaitTimeis unchanged: no timeout, initialization completes when the data source becomes valid or fails permanently.the client did not become ready within the {n}ms start wait time.Implementation details
Follow-up to #60, which introduced the timeout.
ScheduleInitTimeoutis replaced byFailInitializationIfNotReady, called at the end ofInitializeAsyncwhen a start wait was configured:The provider still keeps listening for data source status after failing, so a later successful connection emits a ready event and evaluations are never short-circuited.
Testing:
dotnet test test/LaunchDarkly.OpenFeature.ServerProvider.Tests -f net8.0. The timeout test now asserts the immediate failure, and the "does not time out when the client becomes ready" test covers a client which is ready when initialization is requested.Related spec change: https://github.com/launchdarkly/sdk-specs/pull/257
Link to Devin session: https://app.devin.ai/sessions/0c452d209ec54b068ba120b4c92b8f6c
Open in Devin Desktop: https://app.devin.ai/desktop/session/0c452d209ec54b068ba120b4c92b8f6c?variant=devin
Requested by: @kinyoklion
Note
Overview
Fixes double-wait on provider startup when
StartWaitTimeis greater than zero. The LaunchDarkly client already blocks in the provider constructor for that duration;InitializeAsyncno longer schedules a second timer, so a 5s start wait no longer stretches toward ~10s beforeSetProviderAsynccompletes.When a start wait is configured and the client is still not ready after construction,
InitializeAsyncfails synchronously with an updated message (the client did not become ready within the {n}ms start wait time). Background reconnection is unchanged—a later successful connection can still emit a ready event.StartWaitTimeof zero still means non-blocking construction and async initialization until the data source is valid.README initialization notes are aligned with this behavior; unit tests assert immediate failure and the ready-client success path.
Reviewed by Cursor Bugbot for commit 75a45cd. Bugbot is set up for automated code reviews on this repo. Configure here.