# ktor


09/18/2020, 9:37 AM
Does anyone know how to configure default timeouts on the ktor-client when using OkHttp as an engine? E.g.
Copy code
HttpClient(OkHttp) {
                expectSuccess = false
            }.config {
                // These value exists in the java builder of OkHttp but I don't know how to configure them through the engine {} or config {} ktor api
                callTimeout = 0
                connectTimeout = 0
                readTimeout = 0
                writeTimeout = 0
                pingInterval = 0
I'm guessing I should use this:
Copy code
val client = HttpClient() {
    install(HttpTimeout) {
        // timeout config
        requestTimeoutMillis = 1000
Looking back at it it was maybe a stupid question... I was used to the apache engine where you configured it in the engine


09/21/2020, 10:09 AM
the requestTimeoutMillis is also broader than the engine-level timeouts, it’s implemented with (I believe) so it covers all steps of request-processing. For example if DNS resolving is slow is not covered by connectTimeout
but what happens to the resources of requests that are “abandoned” by configuring requestTimeoutMillis I do not know. I hope they are cleaned up immediately