mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-10 22:46:49 +01:00
use default settings (64) when in emulator
This commit is contained in:
@@ -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.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user