Skip to content

Use StartWaitTime from configuration as provider blocking initialization timeoutΒ #50

@Alex-Tseshinskii

Description

@Alex-Tseshinskii

Is your feature request related to a problem? Please describe.
If LaunchDarkly is transiently unavailable at provider initialization (that happens during OpenFeature.Api.Instance.SetProviderAsync(provider); call), provider initialization does not end (task is not being completed) until the transient problem is resolved.

So, if an application waits for LaunchDarkly initialization as in your basic example here
https://github.com/launchdarkly/openfeature-dotnet-server?tab=readme-ov-file#usage

it will not start until LaunchDarkly host is available

Describe the solution you'd like
I would like that Provider class was taking into the account StartWaitTime configuration value it receives with configuration from the constructor call and returned the control to awaiting execution flow after StartWaitTime has passed

var config = Configuration.Builder("my-sdk-key")
    .StartWaitTime(TimeSpan.FromSeconds(10))
    .Build();

var provider = new Provider(config);

Describe alternatives you've considered
An alternative solution we're using now looks like that

    private readonly Api _featureApi;
    private readonly LaunchDarklyOptions _options;
...
        try {
            await _featureApi.SetProviderAsync(service).WaitAsync(_options.StartWaitTime, cancellationToken);
        }
        catch (TimeoutException) {
// Log unavailability on startup
        }

It looks more like a hack than a clean and neat solution

Additional context
The issue arose during last LaunchDarkly problems induced by AWS unavailability. LaunchDarkly answered with 4XX/5XX codes for about 6 hours, and for Provider class internally that was a "recoverable" problem. So to start our application we had to mock OpenFeature completely out of production version, because our application just couldn't start, waiting for LaunchDarkly connection indefinitely

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions