mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2024-12-25 18:38:32 +03:00
OKHttp: rise maxRequestsPerHost to 64 (instead of default 5)
This commit is contained in:
parent
797dc9ccbb
commit
47bc597b99
1 changed files with 5 additions and 1 deletions
|
@ -21,6 +21,7 @@ import com.squareup.moshi.Moshi
|
||||||
import dagger.Module
|
import dagger.Module
|
||||||
import dagger.Provides
|
import dagger.Provides
|
||||||
import okhttp3.ConnectionSpec
|
import okhttp3.ConnectionSpec
|
||||||
|
import okhttp3.Dispatcher
|
||||||
import okhttp3.OkHttpClient
|
import okhttp3.OkHttpClient
|
||||||
import okhttp3.Protocol
|
import okhttp3.Protocol
|
||||||
import okhttp3.logging.HttpLoggingInterceptor
|
import okhttp3.logging.HttpLoggingInterceptor
|
||||||
|
@ -70,7 +71,9 @@ internal object NetworkModule {
|
||||||
curlLoggingInterceptor: CurlLoggingInterceptor,
|
curlLoggingInterceptor: CurlLoggingInterceptor,
|
||||||
apiInterceptor: ApiInterceptor): OkHttpClient {
|
apiInterceptor: ApiInterceptor): OkHttpClient {
|
||||||
val spec = ConnectionSpec.Builder(matrixConfiguration.connectionSpec).build()
|
val spec = ConnectionSpec.Builder(matrixConfiguration.connectionSpec).build()
|
||||||
|
val dispatcher = Dispatcher().apply {
|
||||||
|
maxRequestsPerHost = 64
|
||||||
|
}
|
||||||
return OkHttpClient.Builder()
|
return OkHttpClient.Builder()
|
||||||
// workaround for #4669
|
// workaround for #4669
|
||||||
.protocols(listOf(Protocol.HTTP_1_1))
|
.protocols(listOf(Protocol.HTTP_1_1))
|
||||||
|
@ -94,6 +97,7 @@ internal object NetworkModule {
|
||||||
proxy(it)
|
proxy(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.dispatcher(dispatcher)
|
||||||
.connectionSpecs(Collections.singletonList(spec))
|
.connectionSpecs(Collections.singletonList(spec))
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue