THis is a straightforward question to ask, although possibly not to answer. In those cases where I am launching a top level coroutine, and don’t (for whatever reason) have a containing scope, I seem to have two options:
CoroutineScope(ContextAwareInterceptor(executor.asCoroutineDispatcher(), context)).launch {
...do some async work
}
or
GlobalScope.launch(ContextAwareInterceptor(executor.asCoroutineDispatcher(), context)) {
...
}
Are there any critical disticntions between these two solutions? The documentation suggests to avoid use of GlobalScope for launch or async, but what rewards am I gaining / risks am I taking by using the first approach?