Add correctDrift option to Stream.periodic (and Timer.periodic?) #18642
Labels
area-core-library
SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.
core-2
library-async
P2
A bug or feature request we're likely to work on
type-enhancement
A request for a change that isn't a bug
This issue was originally filed by sophielight...@gmail.com
Periodic timers are subject to compounding deviation from the originally scheduled intervals over time. It would be useful to have a
correctDrift
or similar option to Stream.periodic which compensates for drift when scheduling the next timer. Thus it would not use Timer.periodic whencorrectDrift
is true. If the scheduled time is already past, then the timer is scheduled immediately (using Duration.ZERO or Timer.run).It would be useful for Timer.periodic too, but the createTimerPeriodic Zone callback signature would need to be updated, which would be a breaking change unless it just accepts callbacks with or without the correctDrift option.
The text was updated successfully, but these errors were encountered: