Hacker News new | ask | show | jobs
by cman1444 27 days ago
A better solution might be to make the intervals coprime with 60. 59 or 61 seconds should work fine.

https://shoppress.dormanproducts.com/hunting-tooth-gearsets/

1 comments

no, you hash your node ID or get a random number, and then just add offset. That guarantees on average uniform load, not synchronized-wave-pattern-that-happens-to-be-59.

You have to consider that when power goes down and everything goes back up at same time you get same pattern back, just spike every 59 seconds instead of 60.

Yeah I thought about that, but I just assumed it would be very unlikely that everything would be initialized at the same time. I suppose your scenario of power being lost simultaneously makes sense when that could happen.