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

obobo

02/11/2019, 9:56 PM
I'm using the Ktor CIO client to call an external service. If the service takes over a certain threshold to respond I want it to fail. Is there any way to do this in the client? I'm currently wrapping the client call with
withTimeout
, but will this handle cleanup properly, will it cancel the in-flight request? (I'm aware of, and using,
connectTimeout
, but I want to timeout on the request as a whole, not just opening a connection.)
e

e5l

02/12/2019, 7:30 AM
Hi @obobo,
withTimeout
is the right way to handle it.
2 Views