does kotlin coroutine suit for fire and forget sce...
# coroutines
t
does kotlin coroutine suit for fire and forget scenario, for example, I want to fire 1000 network request in 5 minutes, something like
viewModelScope.launch{}
but don’t care about the result. When a coroutine is finished, does it goes away or it stays in memory?
d
It goes away.
a
viewModelScope is not good for that - it could be canceled
g
Depends on required lifecycle of those requests. Launch and forget doesn't mean that request doesn't have lifecycle and may be cancelled
t
It has the lifecycle equal to Application’s lifecycle. And I will create my own coroutine scope for that
g
GlobalScope is also fine for this
Tho, we have UserScope which cancelled if app user is unauthorized