feat: Stop waiting for initialization after the configured start wait time - #60
Conversation
🤖 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:
|
|
If the provider later becomes ready will the OpenFeature SDK evaluate correctly? Or will it bypass the provider. |
Evaluations keep going through the provider, both while it is in the error state and after it recovers. The OpenFeature .NET SDK only short-circuits on I extended |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 8867055. Configure here.
… time Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
Co-Authored-By: rlamb@launchdarkly.com <4955475+kinyoklion@users.noreply.github.com>
935b351 to
5a7f3ed
Compare
🤖 I have created a release *beep* *boop* --- ## [2.2.0](2.1.2...2.2.0) (2026-08-20) ### Features * Stop waiting for initialization after the configured start wait time ([#60](#60)) ([86e3d27](86e3d27)) ### Bug Fixes * Do not report a permanent data source failure as fatal ([#59](#59)) ([ed29935](ed29935)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). <!-- CURSOR_SUMMARY --> --- > [!NOTE] > **Overview** > Release Please bump from **2.1.2** to **2.2.0**. Updates the package `Version`, `.release-please-manifest.json`, and `CHANGELOG.md`. > > The changelog documents stopping initialization wait after the configured start wait time (#60) and not treating a permanent data source failure as fatal (#59). No runtime code is changed in this PR. > > <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit d648a25. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).</sup> <!-- /CURSOR_SUMMARY --> Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>

SetProviderAsyncnever completed while LaunchDarkly was unreachable, so applications that await it could not start; the provider now gives up waiting after the configuredStartWaitTime.Closes #50.
Provider(Configuration)usesconfig.StartWaitTimeas an initialization timeout; on expiryInitializeAsyncfails withLaunchDarklyProviderInitExceptionand logs a warningProviderReadyevent and the provider recovers — matching the direction in Use StartWaitTime from configuration as provider blocking initialization timeout #50 ("transition to a provider error state and then continue to attempt to recover")Provider(ILdClient)(internal, and used by tests) still waits indefinitely, since there is no configuration to read a timeout from@cursor review
Implementation details
Mechanism
InitializeAsyncschedules aTask.Delay(StartWaitTime)continuation that, if_initCompletionhas not completed, sets the provider status toErrorand faults the task. Setting the status also consumesStatusProvider's "first event" suppression, which is what allows the subsequentValidstatus to emit a realProviderReadyevent instead of being swallowed as a duplicate of initialization.Semantics worth a reviewer's opinion
new LdClient(config)already blocks for up toStartWaitTimein the provider constructor, and this timeout starts whenInitializeAsyncruns, so a totally offline start can now wait up to twoStartWaitTimeintervals beforeSetProviderAsyncreturns. Measuring the timeout from the constructor instead would require threading a start timestamp through, and would makeStartWaitTimemean something different for the provider than for the SDK. Happy to change it if the doubled worst case is not acceptable.Alternatives considered
SetProviderAsync(provider).WaitAsync(timeout)(the workaround in Use StartWaitTime from configuration as provider blocking initialization timeout #50): leaves the provider without a state transition and the application without an event to recover on.READYfor a provider that has never received data.Testing
dotnet test test/LaunchDarkly.OpenFeature.ServerProvider.Tests -f net8.0— 62 tests pass, including a timeout test, a test that a client which becomes ready before the timeout does not fail, and a test that the provider still emitsProviderReadyafter a timed-out initialization.dotnet build src/LaunchDarkly.OpenFeature.ServerProvider -f netstandard2.0succeeds with no warnings.No visual preview applies — this is a server-side provider change.
Link to Devin session: https://app.devin.ai/sessions/0c452d209ec54b068ba120b4c92b8f6c
Requested by: @kinyoklion
Note
Overview
Stops
InitializeAsync/SetProviderAsyncfrom hanging forever when LaunchDarkly never becomes ready. The provider now treatsConfiguration.StartWaitTimeas an init timeout (unless it is zero, which still means wait indefinitely).On expiry it logs a warning, sets provider status to Error, and faults init with
LaunchDarklyProviderInitException. The SDK client keeps connecting, so a laterValiddata source still emits Ready and evaluations are not blocked. Ready/timeout completion is serialized with_initLock.Reviewed by Cursor Bugbot for commit 5a7f3ed. Bugbot is set up for automated code reviews on this repo. Configure here.