https://kotlinlang.org logo
Title
a

aleksey.tomin

11/17/2020, 10:40 AM
I’ve the problem with ktor-curl on macOS.
val response = <http://httpClient.post|httpClient.post><T>(url) {
                    contentType(ContentType.Application.Json)
                    body = "some json"
                }
This code executed on windows ~1 sec but on macOS - first request < 1 sec but next ~ 15 sec. kotlin 1.4.10, ktor 1.4.2,
io.ktor:ktor-client-curl
and others. How can I look up a problem?
e

e5l

11/17/2020, 10:46 AM
Hey @aleksey.tomin, could you file an issue in YT? I will take a look
a

aleksey.tomin

11/17/2020, 10:47 AM
I will try to extract an example for this
e

e5l

11/17/2020, 10:48 AM
Thanks, It would be great
j

jaguililla

11/17/2020, 12:09 PM
Is it a request to your local machine?
I had problems with names resolved to localhost (not related to Ktor)
a

aleksey.tomin

11/17/2020, 12:48 PM
No. It request to the remote host
@e5l problem with macOS native window and NSApplication.sharedApplication().run() Now I’m creating the example
:tnx: 1
@e5l I’ve replaced
val app = NSApplication.sharedApplication
...
app.run()
by
val app = NSApplication.sharedApplication
...
app.finishLaunching()
while (active.value) {
    app.nextEventMatchingMask(NSEventMaskAny, null, NSDefaultRunLoopMode, true)?.let {
        app.sendEvent(it)
    }
    runBlocking { 
        delay(100.milliseconds)
    }
}
and fix the problem. It’s not a ktor bug. But it can be useful.