<https://stackoverflow.com/q/56347516/1538877>
# ktor
r
It's more idiomatic to call
client.use { ... }
instead of
client.also { ... }
. That will call
close()
automatically.
i
It's not the point, why client closes automatically in 1.1.1, and required to be closed in 1.2.1. Looks like
close
method not calling on
Engine
in both version, code which create AsyncHttpClient is the same. I have no idea what to check also
@e5l how it possible, that JVM terminates without explicit client.close() in 1.1.1?
e
Client holds
runBlocking
if some connection is still active. Probably the validate method doesn’t close the response.
i
Copy code
fun main() {
    val client = AppStoreClient("...", "...")

    runBlocking {
        println(client.validate("..."))
    }

    println("Done")
}
In this case
Done
will be printed, but JVM: 1. ktor-client:1.1.1 - stopped 2. ktor-client 1.2.1 - keep running