I'm on coroutines 0.25.0 (I'm on ktor 0.9.5, becau...
# coroutines
I'm on coroutines 0.25.0 (I'm on ktor 0.9.5, because the 1.0-betas are broken for me) and I need to launch a coroutine in a request handler that will run in the background after the request completes for a while. Naturally the current docs are all about the updated coroutines API -- is plain old
launch {}
what I want in 0.25.0 to make a coroutine that runs entirely disconnected from the coroutine executing the request handling logic?
if it is truly fire and forget, you can use
I'm not familiar with the ktor api, but you can probably create a class which implements
and extends the ktor api somehow. Then you can attach handlers on that class, and use that class as your scope - and when it shuts down then all coroutines related to handling those requests will be correctly cancelled
GlobalScope doesn’t exist in 0.25.0; otherwise I would agree that it seems well suited