Skip to content
Open
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 @@ -50,8 +50,8 @@ import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withContext
import kotlinx.coroutines.withTimeout
import java.io.File
import java.util.concurrent.CopyOnWriteArrayList
import java.util.concurrent.ConcurrentHashMap
import java.util.concurrent.CopyOnWriteArrayList
import java.util.concurrent.TimeoutException
import java.util.concurrent.atomic.AtomicBoolean

Expand Down Expand Up @@ -126,10 +126,10 @@ class DefaultUnleash(
)
else NoOpMetrics()
fetcher = UnleashFetcher(
unleashConfig,
httpClientBuilder.build("poller", unleashConfig.pollingStrategy),
unleashContextState.asStateFlow()
)
unleashConfig = unleashConfig,
httpClient = httpClientBuilder.build("poller", unleashConfig.pollingStrategy),
unleashContext = unleashContextState.asStateFlow()
)
taskManager = LifecycleAwareTaskManager(
dataJobs = buildDataJobs(metrics, fetcher),
networkAvailable = networkStatusHelper.isAvailable(),
Expand Down Expand Up @@ -168,7 +168,9 @@ class DefaultUnleash(
readyOnFeaturesReceived()
}
cache.subscribeTo(fetcher.getFeaturesReceivedFlow())
lifecycle.addObserver(taskManager)
coroutineScope.launch(Dispatchers.Main) {
lifecycle.addObserver(taskManager)
}
if (bootstrapFile != null && bootstrapFile.exists()) {
UnleashLogger.i(TAG, "Using provided bootstrap file")
Parser.proxyResponseAdapter.fromJson(bootstrapFile.readText())?.let { state ->
Expand Down
Loading