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

Cyrille QUÉMIN

03/31/2021, 8:17 AM
Hey all, I have a question: what is the difference between:
Copy code
install(HttpTimeout) {
    requestTimeoutMillis =
    connectTimeoutMillis =          
}
And
Copy code
engine {
    endpoint {
        connectTimeout = 
        connectRetryAttempts = 
    }
    requestTimeout = 
}
In particular I could see the timeout from
HttpTimeout
working but I could also see the default value of
engine.requestTimeout
being used (before I changed it). Also, which
connectTimeout
will be used ?
HttpTimeout
of the one
engine.endpoint
? Note, I am using the CIO engine with Ktor 1.4.2
r

Rustam Siniukov

03/31/2021, 2:26 PM
Hi! Every engine has its own timeout mechanisms and you can specify them directly using
engine { ... }
block. But it can be more convenient to specify them all once by using
HttpTimeout
feature. In practice, it doesn’t handle
connectTimeout
and
socketTimeout
itself, but only sets it to engine. If you set both,
HttpTimeout
config will win
c

Cyrille QUÉMIN

04/01/2021, 9:23 AM
Understood: I have now set both to the same value. But, I didn't' set the engine timeout initially, I was still seeing it kicking, as well as the other timeout too!
2 Views