Is there any guarantee to `delay`? Atleast that it...
# coroutines
u
Is there any guarantee to
delay
? Atleast that it won't resume sooner than the deadline?
f
the delay is controlled by the dispatcher. In tests, the test dispatcher will bypass delays, so they can resume before the actual amount of time has lapsed
u
I mean in the non test ones
I have something which needs to change state say 15seconds before the end of its validity (which means state is now eligible to reactivate) so, I’m not sure how to model this, since there no “time” Flow. I could setup a timer flow to the given value, but I don’t trust it to be accurate, so I basically just generate a “tickle” which then reevaluates the condition (i.e. the 15 seconds before end of validity) Or, can I rely on it? To just inform the state to change to “eligible to reactivate” without double checking?
g
As Francesc said, precise detail depend on your dispatcher implementation. But I would say that general rule, that delay will not executed earlier than you requested, but may be executed later, though it matter of milliseconds (depending on implementation of dispatcher and even OS). So depends on how precise you want to be