Sebastian Law f1ac25809c
[tasks] Fix behavior when task overruns interval
In a scenario with `tasks.loop(seconds=5)`:

The task takes 30 seconds to run on the first two iterations, and then
is nearly instant for iterations afterward. The behavior should be
that the task runs at:

t = 0  (on time)
t = 30 (late, should've been at t = 5)
t = 60 (late, should've been at t = 10)
t = 60 (late, should've been at t = 15)
t = 60 (late, should've been at t = 20)
t = 60 (late, should've been at t = 25)
... 6 more iterations
t = 60 (on time)
t = 65 (on time)

In a scenario with a loop with explicit times set at UTC 1pm, 2pm, 
3pm, 4pm, and 5pm:

- The task takes 6 hour to run on the first iteration, and then is
  nearly instant for iterations afterward. Assuming the task is started
  at noon, the behavior should be that the task runs at `t = 0` and
  then at `t = 3600` 4 times ("catching up" on the missed iterations
  at 2pm, 3pm, 4pm, and 5pm).

- The task takes 30 days to run on the first iteration, and then is
  nearly instant for iterations afterward. Assuming the task is started
  at noon, the behavior should be that the task runs at `t = 0` and
  then at `t = 43200` 149 times ("catching up" on the missed
  iterations for the past month).

This behavior should be documented in the ext.tasks docs
2022-02-26 01:48:27 -05:00
..