Skip to content
Snippets Groups Projects
Commit 77aad2c0 authored by ale's avatar ale
Browse files

Forgot a 10^9 multiplier when computing initial offset of periodic tasks

parent 4e5224f5
No related branches found
No related tags found
No related merge requests found
......@@ -23,7 +23,7 @@ func New() *Scheduler {
func (s *Scheduler) Add(event PeriodicEvent) {
// Schedule the task at some random point in the future during its
// first interval, so that all tasks are scattered equally.
intervalFrac := time.Duration(event.Interval().Seconds() * rand.Float64())
intervalFrac := time.Duration(event.Interval().Seconds()*rand.Float64()) * time.Second
when := time.Now().Add(intervalFrac)
s.scheduleCh <- &timerData{
event: event,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment