When I read the article I’m thinking the the imple...
# coroutines
g
When I read the article I’m thinking the the implementation of CoroutineScope is more important when you do things such as Activitys in android etc. Our microservices are strictly backend and the dependency context of the application is created once during start so we don’t typically do “new MyService()”
e
If your life-time == the whole life-time of VM, then
GlobalScope
is what you should use
g
In this case it is since we are running the app in a container. When you say the whole life-time of the VM instead of the whole life-time of the App, does that mean that coroutines could potentially be left hanging when an app is killed? So if I run two Apps on the same JVM I shouldn’t use GloablScope?
e
Two apps on the same JVM -> don’t use
GlobalScope
.
GlobalScope
== JVM life-time. If you have multiple services in the same JVM with different life-times, then create a separate scope for each service.