KotlinX.Coroutines.test question: can something el...
# coroutines
c
KotlinX.Coroutines.test question: can something else than the CoroutineContext of a coroutine impact the behavior of
delay()
? I have a weird case where a coroutine is blocked indefinitely on
delay(1)
. I have compared the CoroutineContext with other places in the code where
delay(1)
correctly finishes immediately, and they are the same. What else should I try to find the source of the issue? When I say it runs indefinitely, I really do mean indefinitely. Even setting the timeout argument of
runTest
or using
withTimeoutOrNull
doesn't stop it.
Found the cause: I had a coroutine that was actively waiting on a condition (
while(cond) { yield() }
), and because the time is stopped in
runTest
as long as something is actively running, the
delay
could never end