Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Global ctx passed into the provider via FeatureProvider #9

Merged
merged 1 commit into from
May 22, 2023

Conversation

fabriziodemaria
Copy link
Member

@fabriziodemaria fabriziodemaria commented May 19, 2023

Waiting for SDK change: spotify/openfeature-kotlin-sdk#7

val parsedKey = FlagKey(key)
val evaluationContext = currEvaluationContext ?: throw ProviderNotReadyError()
val evaluationContext = context ?: throw InvalidContextError()
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A missing context here means that no global context has been set in the global SDK, but a context is required in our Provider. It's not the Provider that is not ready, but the Context from the SDK that is invalid/missing.

override suspend fun initialize(initialContext: EvaluationContext?) {
currEvaluationContext = initialContext
Copy link
Member Author

@fabriziodemaria fabriziodemaria May 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The initialContext is still passed via inizitialize for the Provider to be able to warm up the cache. Subsequent evaluations will use the global context defined in the SDK, and if the cached-context is different than the evaluation-context, the evaluation will fail with reason STALE

@fabriziodemaria fabriziodemaria marked this pull request as ready for review May 22, 2023 10:54
@fabriziodemaria fabriziodemaria merged commit fc1dcad into main May 22, 2023
@fabriziodemaria fabriziodemaria deleted the ctx-passed-in branch May 22, 2023 10:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants