Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

periodically has a random initially delay #94

Open
shmish111 opened this issue Aug 24, 2016 · 5 comments
Open

periodically has a random initially delay #94

shmish111 opened this issue Aug 24, 2016 · 5 comments

Comments

@shmish111
Copy link
Contributor

Why does periodically have a random initial delay (less than the period) if none is provided?

(- period (rem (System/currentTimeMillis) period))

I assumed that it would default to 0, to me this is very strange.

@ztellman
Copy link
Collaborator

Either periodically has a non-deterministic initial delay, or a non-deterministic start time. I thought having all periodic functions with the same period running at more or less the same time would be desirable, but I'm not particularly married to that. Thoughts?

@shmish111
Copy link
Contributor Author

Don't quite understand, why would the start time be non-deterministic if initial delay is 0?

@vspinu
Copy link

vspinu commented Sep 2, 2016

The start is actually deterministic, but because it's undocumented it looks as if it's random. IMHO this is a complementary and potentially quite useful features - your 60sec periods will overlap with 10sec periods every 6th time. 0-delay can always be supplied manually if the user wants so.

@vspinu
Copy link

vspinu commented Sep 2, 2016

If you are using periodically for logging you will get nice round times which are modulo aligned with the period. So I personally think this feature should stay. It just needs to be documented properly.

@ztellman
Copy link
Collaborator

ztellman commented Sep 2, 2016

I'll come up with some better documentation, or am happy to take a pull request if you think you can explain it clearly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants