mirror of
https://github.com/InvertGeek/MixFile.git
synced 2026-06-10 00:27:17 +08:00
optimize okhttp
This commit is contained in:
@@ -15,8 +15,8 @@ android {
|
||||
applicationId = "com.donut.mixfile"
|
||||
minSdk = 24
|
||||
targetSdk = 35
|
||||
versionCode = 73
|
||||
versionName = "1.9.1"
|
||||
versionCode = 74
|
||||
versionName = "1.9.2"
|
||||
|
||||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
|
||||
vectorDrawables {
|
||||
|
||||
@@ -15,11 +15,19 @@ import io.ktor.serialization.gson.GsonConverter
|
||||
import io.ktor.serialization.gson.gson
|
||||
import io.ktor.utils.io.ByteWriteChannel
|
||||
import io.ktor.utils.io.jvm.javaio.toOutputStream
|
||||
import okhttp3.Dispatcher
|
||||
import java.io.InputStream
|
||||
|
||||
var UPLOAD_RETRY_TIMES by cachedMutableOf(3, "UPLOAD_RETRY_TIMES")
|
||||
|
||||
val uploadClient = HttpClient(OkHttp).config {
|
||||
val uploadClient = HttpClient(OkHttp) {
|
||||
engine {
|
||||
config {
|
||||
val dispatcher = Dispatcher()
|
||||
dispatcher.maxRequestsPerHost = 100
|
||||
dispatcher(dispatcher)
|
||||
}
|
||||
}
|
||||
install(ContentNegotiation) {
|
||||
gson()
|
||||
register(ContentType.Any, GsonConverter(GsonBuilder().create()))
|
||||
|
||||
Reference in New Issue
Block a user