Can anyone pls explain how come `delay` sometimes ...
# coroutines
m
Can anyone pls explain how come
delay
sometimes takes 30m instead of expected 4m (that were supplied as argument)? It is observed on Android.
j
Maybe you're running this
delay()
in a dispatcher with a limited number threads, and running blocking code in that same dispatcher at the same time, which would prevent it from resuming other coroutines. Could you please share a bit more details about those coroutines?
l
App/device put in deep sleep
👆 2
delay is based on SystemClock.uptimeMillis
Because delay is based on Handler.postDelayed which uses this clock, and doesn't itself put any wakelock
today i learned 2
m
@Joffrey thx, but probably not it, since I have reproduced with MainDispatcher and I would expect ANRs in that case @louiscad Thank you, that explains it. Today I learned that delay has Android specific implementation.