(cross question from coroutines) Is it a typical p...
# ktor
d
(cross question from coroutines) Is it a typical pattern to pass around the coroutine scope (io.ktor.application.Application object) as a parameter to my suspend functions?
t
It's actually an anti pattern to have
suspend fun CoroutineScope.foo()
. An extension function on
CoroutineScope
should start coroutines in the provided scope, while a
suspend fun
should only return after all its async work is done. To access the current scope from a suspend fun, use the
coroutineScope
block.