use default settings (64) when in emulator

This commit is contained in:
davotoula
2025-09-17 15:01:46 +02:00
parent c1012bd859
commit 2027c7d77d

View File

@@ -37,8 +37,6 @@ class OkHttpClientFactory(
const val DEFAULT_IS_MOBILE: Boolean = false const val DEFAULT_IS_MOBILE: Boolean = false
const val DEFAULT_TIMEOUT_ON_WIFI_SECS: Int = 10 const val DEFAULT_TIMEOUT_ON_WIFI_SECS: Int = 10
const val DEFAULT_TIMEOUT_ON_MOBILE_SECS: Int = 30 const val DEFAULT_TIMEOUT_ON_MOBILE_SECS: Int = 30
const val MAX_REQUESTS_EMULATOR: Int = 32
const val MAX_REQUESTS_DEVICE: Int = 512
private fun isEmulator(): Boolean = private fun isEmulator(): Boolean =
Build.FINGERPRINT.startsWith("generic") || Build.FINGERPRINT.startsWith("generic") ||
@@ -62,11 +60,10 @@ class OkHttpClientFactory(
val myDispatcher = val myDispatcher =
Dispatcher().apply { Dispatcher().apply {
if (isEmulator()) { if (!isEmulator()) {
maxRequests = MAX_REQUESTS_EMULATOR maxRequests = 512
Log.i("OkHttpClientFactory", "Emulator detected, using reduced maxRequests: $MAX_REQUESTS_EMULATOR.")
} else { } else {
maxRequests = MAX_REQUESTS_DEVICE Log.i("OkHttpClientFactory", "Emulator detected, using default maxRequests: 64.")
} }
} }