Joseph D
07/01/2020, 5:18 PMviewModelScope.launch(<http://Dispatchers.IO|Dispatchers.IO>) {
block()
foo1()
}
If block’s body contains
viewModelScope.launch(Dispatchers.Main) {
foo2()
}
foo1() is never executed. can somebody explain me why?zak.taccardi
07/01/2020, 5:18 PMoctylFractal
07/01/2020, 5:18 PMblock()
?fatih
07/01/2020, 5:20 PMJoseph D
07/01/2020, 5:22 PMis your block() suspending?yes sir (hi, i know from twitter, what’s up)
is that the entirety ofno, that code is executed during flow.collect{} method?block()
Are you cancelling the scope somewhere?no i am not
octylFractal
07/01/2020, 5:25 PMflow.collect {}
sounds like it might be the issue, but if it only happens when you add that launch
, I can't make sense of itJoseph D
07/01/2020, 5:53 PMkotlinx.coroutines.JobCancellationException: Job was cancelled; job=SupervisorJobImpl{Cancelling}@e1ab056
I will investigate whyDaniel
07/01/2020, 6:17 PMoctylFractal
07/01/2020, 6:18 PMlaunch
?Joseph D
07/01/2020, 6:44 PMoctylFractal
07/01/2020, 6:45 PMfinally
is probably a good option here