logoalt Hacker News

schiffern • today at 3:42 PM • 1 reply • view on HN

I almost wrote 59.999 seconds too, but I figured someone would nitpick that the timing often won't be that accurate or will get coalesced. ;)

I should have said, you almost always want to use the randomly staggered timers on initialization, not just when the exact timer interval matters! It's also important to test electricity or backend outages, which can unintentionally synchronize all the timers.


Replies

vlovich123 • today at 3:52 PM

You have good advice and I missed the “on startup” for the wait.

A common aggregation is about 10ms although most OSes can give you finer granularity accuracy if you ask for it and have permissions. It really depends on how long the task takes and whether there’s any non-uniformity in its processing to make finer granularity helpful or harmful.

Unfortunately some people do read advice like it’s mana from the gods instead of thinking through the implication on their specific problem.