https://kotlinlang.org logo
#ktor
Title
# ktor
r

rrva

06/15/2020, 4:05 PM
when using https://ktor.io/clients/http-client/features/timeout.html and
requestTimeoutMillis
it is not needed to set connectionRequestTimeout on the engine level as well, right? I am thinking to add to the following code
Copy code
val client = HttpClient(Apache) {
    engine {
        connectionRequestTimeout = 400
    }
    install(HttpTimeout) {
        connectTimeoutMillis = 400
        socketTimeoutMillis = 100
    }
}
into
Copy code
val client = HttpClient(Apache) {
    engine {
        connectionRequestTimeout = 400
    }
    install(HttpTimeout) {
        requestTimeoutMillis = 400
        connectTimeoutMillis = 400
        socketTimeoutMillis = 100
    }
}
Mostly to cover time spent in cases not covered by the other three timeouts (name resolution in DNS for example)
e

e5l

06/16/2020, 12:10 PM
Hi @rrva, yes. The engine level configuration is obsolete since we have a common timeout feature
r

rrva

06/16/2020, 12:11 PM
so it’s recommended to only set
requestTimeoutMillis
and nothing more?
👍 1
c

Cyrille QUÉMIN

03/31/2021, 8:33 AM
This is not true for the CIO engine. Or not true anymore perhaps? as I have posted today a question around this. Since I can see that both timeout are used but I can't really understand exactly when was is vs the other one