Is there a clear pattern for launching true backgr...
# coroutines
y
Is there a clear pattern for launching true background work? Does supervisorScope instead of coroutineScope allow the work to continue in the background, while coroutineScope returns sooner?
Actually I guess it's just GlobalScope
r
@yschimke “The reason to avoid GlobalScope” by Roman Elizarov https://link.medium.com/WdakIStizU
s
I’m somewhat curious how to do this as well. I am using Kotlin server side and have a couple of Spring controllers that boot at application launch and then stick around forever. Wanted some of them to be able to spin off large batch updates asynchronously. Had my controller class extending CoroutineScope. Ran into an issue with exceptions being thrown inside a launch {} and I think what I needed to do was declare an exception handler in order to not cause that to brick my scope.
b
You can still have your own "ApplicationScope" that has a lifecycle managed by your application instead of GlobalScope that's managed by the lifecycle of the runtime (ie, JVM)
e
forever == while JVM is alive ==
GlobalScope
r
@elizarov thank you for explicit point