Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@iravid
Copy link
Member

@iravid iravid commented Aug 29, 2020

This commit fixes two issues:

  1. The state maintained by fixed keeps the schedule's start time and the last run. The last run was wrongly initialized to the start time instead of start + interval. This caused a redundant immediate repetition when starting.

  2. The delay computation was wrongly computed as (now - start) % interval. For example, given start = 0, now = 5000, intervalMillis = 3000, the delay would be 2000 instead of 1000.

    This is fixed by computing the delay as interval - ((now - start) % interval).

Resolves #4144.

This commit fixes two issues:
1. The state maintained by `fixed` keeps the schedule's start time and
   the last run. The last run was wrongly initialized to the start time
   instead of `start + interval`. This caused a redundant immediate
   repetition when starting.

2. The delay computation was wrongly computed as `(now - start) %
   interval`. For example, given `start = 0, now = 5000,
   intervalMillis = 3000`, the delay would be `2000` instead of
   `1000`.

   This is fixed by computing the delay as `interval - ((now - start)
   % interval)`.
@iravid iravid requested review from adamgfraser and jdegoes August 29, 2020 08:37
@iravid iravid force-pushed the schedule-fixed-fix branch from f777f73 to 828913f Compare August 29, 2020 09:37
@iravid iravid force-pushed the schedule-fixed-fix branch from 828913f to 55f912a Compare August 29, 2020 09:38
@jdegoes
Copy link
Member

jdegoes commented Aug 29, 2020

Awesome fixes!

@iravid iravid merged commit d1111dc into zio:master Aug 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ZStream#repeat doesn't repeat a stream evenly. ZStream#schedule is probably broken either.

2 participants