Hey!! need your help, I'm working on a Compose Mul...
# ktor
e
Hey!! need your help, I'm working on a Compose Multiplatform project, using Ktor for fetching info from an API. The issue that i have sometimes is this one:
Copy code
Request timeout has expired [url=<https://consultas.ourclub.io/sanluis/personas?documento=35073072>, request_timeout=40000 ms])
Only happens sometimes, maybe when i do a clean/fresh installation. And i have to retry the call again to work. Max 3 tries and then works. This is my configuration:
Copy code
single<HttpClient> {
    HttpClient {
        install(ContentNegotiation) {
            json(json = Json { ignoreUnknownKeys = true }, contentType = ContentType.Any)
        }

        install(HttpTimeout) {
            requestTimeoutMillis = 40000
            connectTimeoutMillis = 40000
            socketTimeoutMillis = 40000
        }
    }

}
The issue is same for Android and iOS
Copy code
suspend fun getPersonInformation(document: String, apiKey: String): Person? {
    val requestBody = RequestBody(
        csv = false,
        campos = listOf("apellido", "nombre", "nrosocio", "email", "documento", "personaid")
    )
    return <http://client.post|client.post>("<https://consultas.ourclub.io/sanluis/personas?documento=$document>") {
        header("X-Api-Key", apiKey)

        contentType(ContentType.Application.Json)

        setBody(requestBody)
    }.body()
}
a
Can you reproduce the problem by making requests from the same devices using another HTTP client?
e
I’ll try using Retrofit for Android
👍 1
Hey @Aleksei Tirman [JB] i did a test using Retrofit and i didn't have the timeout issue
a
Can you please file an issue with a sample project attached to reproduce the problem?
🫶 1