https://kotlinlang.org logo
d

dMusicb

01/15/2021, 9:29 PM
Is there a way to monitor/assert there are no coroutines in a pending (maybe wrong word) state? i.e. I have a piece of code that dispatches some work in a coroutine on Dispatchers.IO and I'm having some trouble with it bleeding over between integration tests so I want to have a check that confirms all coroutines have completed
b

bbaldino

01/16/2021, 12:31 AM
I don't know of any built-in way, but you could register the jobs from the coroutines somewhere, and verify they're all finished?
a

Animesh Sahu

01/16/2021, 3:18 AM
context[Job].children.count() == 0
?
4 Views