flaky-noon-11399
05/12/2025, 10:55 AMancient-car-96302
05/12/2025, 1:35 PMancient-car-96302
05/12/2025, 3:05 PMautoRefreshFeatures() works fine. It is hard reproducible issueancient-car-96302
05/12/2025, 3:08 PMancient-car-96302
05/12/2025, 3:12 PMflaky-noon-11399
05/12/2025, 3:49 PMcalm-dog-24239
05/13/2025, 8:39 AMflaky-noon-11399
05/14/2025, 3:24 PMcalm-dog-24239
05/14/2025, 3:56 PMancient-car-96302
05/14/2025, 6:54 PMancient-car-96302
05/15/2025, 3:43 AMcalm-dog-24239
05/15/2025, 8:20 AMsilly-art-19522
05/15/2025, 8:36 AMNetworkDispatcher, I was not adding any configuration. Just using the default GBNetworkDispatcherKtor(), which uses Ktor HttpClient.
⢠After updating the dispatcher to v1.0.6, I'm getting the same HttpRequestTimeoutException (seems noting changed, just 1.0.5 had a bug?)ancient-car-96302
05/15/2025, 9:19 AMsilly-art-19522
05/15/2025, 9:31 AMsilly-art-19522
05/15/2025, 9:37 AMsilly-art-19522
05/15/2025, 11:50 AMsuspend fun initializaSdk() {
gbSdk = sdkBuilder.initialize()
gbSdk.autoRefreshFeatures().collect {...
}
Than it errors. Launching autoRefreshFeatures in a separate coroutine solves it:
suspend fun initializaSdk() {
gbSdk = sdkBuilder.initialize()
CoroutineScope(Dispatchers.IO).launch {
gbSdk.autoRefreshFeatures().collect {...
}
}flaky-noon-11399
05/15/2025, 12:00 PMsilly-art-19522
05/15/2025, 12:00 PMsilly-art-19522
05/15/2025, 12:01 PMrefreshCache after the error, than the reads will work.silly-art-19522
05/15/2025, 12:01 PMsilly-art-19522
05/15/2025, 12:21 PM.setQAMode, etc. This is what I have now:
fun initializeSdk() { // not suspend
val sdkBuilder = GBSDKBuilder(
apiKey = apiKey,
hostURL = hostUrl,
attributes = emptyMap(),
trackingCallback = DefaultGBTrackingCallback(appPackage),
networkDispatcher = GBNetworkDispatcherKtor(),
)
sdk = sdkBuilder.initialize()
CoroutineScope(<http://Dispatchers.IO|Dispatchers.IO>).launch {
sdk.enableAutoRefresh()
}
}
private suspend fun GrowthBookSDK.enableAutoRefresh() {
autoRefreshFeatures().collectLatest {
when (it) {
is Resource.Success -> {
GLog.v("FeatureFlags auto refreshed successfully.")
}
is Resource.Error -> {
GLog.e(it.exception, "FeatureFlags auto refreshing failed!")
refreshCache()
}
}
}
}
Before it errors, the streaming (auto refresh) works, after timeout error (time can be set to control via Ktor HttpClient).
After it errors it doesn't work. And reads don't work either. Calling to refreshCache() after error enables the reads to work.calm-dog-24239
05/15/2025, 12:29 PMsilly-art-19522
05/15/2025, 12:38 PMautoRefreshFeatures after 5-6 mins?