fix: Timeout issue for people running reverse proxy.

It seem like the 10 second timeout for POST gives timeout for nginx users that uses reverse proxy and this should fix it.

Signed-off-by: KaiserBh <kaiserbh@proton.me>
This commit is contained in:
KaiserBh 2023-11-22 23:15:23 +11:00
parent 2a69a1eeb0
commit adf1f87364
No known key found for this signature in database
GPG Key ID: 14D73B142042BBA9

View File

@ -14,6 +14,7 @@ import okhttp3.RequestBody.Companion.gzip
import okhttp3.RequestBody.Companion.toRequestBody import okhttp3.RequestBody.Companion.toRequestBody
import tachiyomi.core.util.system.logcat import tachiyomi.core.util.system.logcat
import tachiyomi.domain.sync.SyncPreferences import tachiyomi.domain.sync.SyncPreferences
import java.util.concurrent.TimeUnit
class SyncYomiSyncService( class SyncYomiSyncService(
context: Context, context: Context,
@ -52,7 +53,12 @@ class SyncYomiSyncService(
val apiKey = syncPreferences.syncAPIKey().get() val apiKey = syncPreferences.syncAPIKey().get()
val uploadUrl = "$host/api/sync/upload" val uploadUrl = "$host/api/sync/upload"
val client = OkHttpClient() // Set timeout to 30 seconds
val client = OkHttpClient.Builder()
.connectTimeout(30, TimeUnit.SECONDS)
.readTimeout(30, TimeUnit.SECONDS)
.writeTimeout(30, TimeUnit.SECONDS)
.build()
val headers = Headers.Builder().add( val headers = Headers.Builder().add(
"Content-Type", "Content-Type",