Why does the route not return until what is runnin...
# ktor
f
Why does the route not return until what is running inside the launch is done? I thought that
launch
returned immediatly and ran whatever was inside on a new thread.
Copy code
launch {
    doStuff()
}
call.respond(Created)
b
It's launched inside the CoroutineScope of the current call though. So it will wait until all child jobs are done
f
Yeah I figured. I now use
Dispatchers.Default
instead as suggested here https://medium.com/@elizarov/the-reason-to-avoid-globalscope-835337445abc it works!
a
Doesn't this mean that the launch can be cancelled if the route returns?
f
Dont know, it does not get cancelled for me
b
It should get cancelled if the only difference is that you're using a different Dispatcher. The route shouldn't return until the job is done still afaik