``` suspend fun request(offset: Int, limit: Int, e...
# ktor
v
Copy code
suspend fun request(offset: Int, limit: Int, endpoint: String) : ApiResponse<List<Map<String,Any>>> {
        val end = limit + offset
        
        return retroClient.request(endpoint = endpoint, offset = offset, limit = limit).execute().body()!! //using retrofit, works

//        internalClient.request {
//            url(URL("$BASE_URL$endpoint?offset=$offset&limit=$limit&format=json&api_key=$API_KEY"))
//            method = HttpMethod.Get
//            headers {
//                append("User-Agent" , "Ktor Apache Client")
//                append("Content-Type", "application/json")
//            }
//        }
    }
u
First of all you might want to use launch instead of async if you do not await a result
v
I tried that too, ain't the source of problems
initially I was waiting for results
but it doesn't matter which one you use, so that ain't the cause
e
Hi @Vinicius Carvalho, what engine do you use?
v
@e5l Apache
Copy code
val internalClient = HttpClient(Apache) {
        engine {
            connectTimeout = 30_000
            socketTimeout = 60_000
        }
        install(JsonFeature){
            serializer = JacksonSerializer{
                jacksonObjectMapper()
                    .registerModule(JavaTimeModule())
                    .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false)
            }

        }
    }
e
Could you try it with
1.1.2
? We fixed some
Apache
performance problems.
v
absolutely, thank you