Skip to content

refactor: Rename shutdown event to notready event #97

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

Merged
merged 1 commit into from
Feb 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class EventHandler(dispatcher: CoroutineDispatcher) :
ProviderStatus {
private val sharedFlow: MutableSharedFlow<OpenFeatureEvents> = MutableSharedFlow()
private val currentStatus: MutableStateFlow<OpenFeatureEvents> =
MutableStateFlow(OpenFeatureEvents.ProviderShutDown)
MutableStateFlow(OpenFeatureEvents.ProviderNotReady)
private val job = Job()
private val coroutineScope = CoroutineScope(job + dispatcher)

Expand All @@ -40,7 +40,7 @@ class EventHandler(dispatcher: CoroutineDispatcher) :
sharedFlow.collect {
currentStatus.value = it
when (it) {
is OpenFeatureEvents.ProviderShutDown -> {
is OpenFeatureEvents.ProviderNotReady -> {
job.cancelChildren()
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package dev.openfeature.sdk.events

sealed interface OpenFeatureEvents {
object ProviderNotReady : OpenFeatureEvents
object ProviderReady : OpenFeatureEvents
data class ProviderError(val error: Throwable) : OpenFeatureEvents
object ProviderStale : OpenFeatureEvents
object ProviderShutDown : OpenFeatureEvents
}
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class EventsHandlerTest {
val eventHandler = EventHandler(dispatcher)
val provider = TestFeatureProvider(dispatcher, eventHandler)

Assert.assertEquals(OpenFeatureEvents.ProviderShutDown, provider.getProviderStatus())
Assert.assertEquals(OpenFeatureEvents.ProviderNotReady, provider.getProviderStatus())

provider.emitReady()

Expand All @@ -201,6 +201,6 @@ class EventsHandlerTest {

provider.shutdown()

Assert.assertEquals(OpenFeatureEvents.ProviderShutDown, provider.getProviderStatus())
Assert.assertEquals(OpenFeatureEvents.ProviderNotReady, provider.getProviderStatus())
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class TestFeatureProvider(
}

override fun shutdown() {
eventHandler.publish(OpenFeatureEvents.ProviderShutDown)
eventHandler.publish(OpenFeatureEvents.ProviderNotReady)
}

override fun onContextSet(oldContext: EvaluationContext?, newContext: EvaluationContext) {
Expand Down