Skip to content

[FEATURE] Update setProvider to be async and remove setProviderAndWait #695

Open
@beeme1mr

Description

@beeme1mr

Requirements

Overview

When setProvider was first introduced, OpenFeature didn't have support for provider initialization. It was expected that a provider was initialized prior to registering it with OpenFeature. Since then, OpenFeature has added support for initialization so that the SDK could have an awareness of the provider lifecycle and is able to emit events that developers can subscribe to. Unfortunately, this meant that a provider may not be available immediately after registration. To overcome this, developers could wait for the provider ready event to fire before performing flag evaluations. A method called setProviderAndWait was also added that returned a promise. The promise resolves when the provider is ready or is rejected if there's an error during initialization.

We've received feedback that setProviderAndWait behaves the way people expect setProvider to work. Also, setProviderAndWait is not a good name in JavaScript because it does not block a thread as the name implies. For these reasons, setProvider should be updated to behave like setProviderAndWait and setProviderAndWait should be removed. This will be a breaking change that will require a v2.0.0 of the server SDK.

Requirements

  • setProvider returns a promise that's resolved when the provider is ready or is rejected if the provider fails during initialization.
  • Remove setProviderAndWait
  • Update the documentation in the readme

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions