Improves timeouts to download and upload files
This commit is contained in:
+3
-4
@@ -73,13 +73,12 @@ class OkHttpClientFactory(
|
|||||||
userAgent: String,
|
userAgent: String,
|
||||||
): OkHttpClient {
|
): OkHttpClient {
|
||||||
val seconds = if (proxy != null) timeoutSeconds * 3 else timeoutSeconds
|
val seconds = if (proxy != null) timeoutSeconds * 3 else timeoutSeconds
|
||||||
val duration = Duration.ofSeconds(seconds.toLong())
|
|
||||||
return rootClient
|
return rootClient
|
||||||
.newBuilder()
|
.newBuilder()
|
||||||
.proxy(proxy)
|
.proxy(proxy)
|
||||||
.readTimeout(duration)
|
.connectTimeout(Duration.ofSeconds(seconds.toLong()))
|
||||||
.connectTimeout(duration)
|
.readTimeout(Duration.ofSeconds(seconds.toLong() * 3))
|
||||||
.writeTimeout(duration)
|
.writeTimeout(Duration.ofSeconds(seconds.toLong() * 3))
|
||||||
.addInterceptor(DefaultContentTypeInterceptor(userAgent))
|
.addInterceptor(DefaultContentTypeInterceptor(userAgent))
|
||||||
.addNetworkInterceptor(logging)
|
.addNetworkInterceptor(logging)
|
||||||
.addNetworkInterceptor(keyDecryptor)
|
.addNetworkInterceptor(keyDecryptor)
|
||||||
|
|||||||
Reference in New Issue
Block a user