Open shmish111 opened 8 years ago
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?
Don't quite understand, why would the start time be non-deterministic if initial delay is 0?
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.
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.
I'll come up with some better documentation, or am happy to take a pull request if you think you can explain it clearly.
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.