Hello, with this code, why it hang up ? As you can...
# ktor
d
Hello, with this code, why it hang up ? As you can see at console.log, it stop at the total cpu core
Copy code
suspend fun main () = coroutineScope {
    var counter = 1
    launch {
        while (true) {
            HttpClient(Apache) {
                engine {

                }
            }.use {
                val clientResponse = it.call {
                    method = <http://HttpMethod.Post|HttpMethod.Post>
                    url(URL("<https://httpbin.org/post>"))
                    body = TextContent(bodyVal, contentType = ContentType("application", "json"))
                }.response

                val jsonResponseString = String(clientResponse.readBytes())

                println(counter.toString())
                counter += 1
            }
        }
    }

    println("abc")
}
e
It looks like a bug from kotlinx.coroutines: https://github.com/Kotlin/kotlinx.coroutines/issues/990
d
hmm i see ~ Thank you bro
e
No problem. Please consider reusing instance of HttpClient for now.
d
@e5l my http request need to set proxy setting, is it possible to set it at run time ?
e
You have to specify it during the client configuration for now.
d
so If the proxy is changes, I cannot reusing the instance of http client, right ?
👌 1
I mean, if the proxy setting for each request is different, I cannot reusing the created instance of http client, right ?
👌 1
e
Probably we should support late engine configuration or introduce a common proxy feature.
d
Yes, because other http client like fuel and jetty can set proxy setting at run time Btw thanks for the information