https://kotlinlang.org logo
#coroutines
Title
# coroutines
b

Big Chungus

10/21/2020, 12:48 PM
I'm getting random
kotlinx.coroutines.TimeoutCancellationException: Timed out waiting for 15000 ms
(Not serring timeouts anywhere explicitly). Does anyone know how I could increase this?
m

Marc Knaup

10/21/2020, 12:58 PM
What is timed out? Coroutines themselves don’t time out. HTTP requests do.
withTimeout { … }
calls do.
b

Big Chungus

10/21/2020, 12:58 PM
I see, gonna have to dig my ktor-client calls, then 😕
Although i have it configured with much larger timeout (5min)
Copy code
HttpClient {
    install(JsonFeature) {
      serializer = KotlinxSerializer(prettyJson)
    }
    install(HttpTimeout) {
      val timeout = 5 * 60 * 1000L
      requestTimeoutMillis = timeout
      connectTimeoutMillis = timeout
      socketTimeoutMillis = timeout
    }
    
  }
m

Marc Knaup

10/21/2020, 1:00 PM
What engine are you using? Maybe it’s not set up by Ktor properly.
b

Big Chungus

10/21/2020, 1:00 PM
CIO on JVM
Here's a list of ktor dependencies in my project
Copy code
implementation("io.ktor:ktor-client-cio:1.4.1")
  implementation("io.ktor:ktor-client-serialization:1.4.1")
m
b

Big Chungus

10/21/2020, 1:03 PM
🤦‍♂️
Thanks, will change to apache
m

Marc Knaup

10/21/2020, 1:04 PM
No, you can set the timeout. See the comment in the issue tracker
b

Big Chungus

10/21/2020, 1:04 PM
Oh, right
Thanks man!
4 Views