Jitter loop timing

This commit is contained in:
Ian Gulliver
2022-10-28 15:59:00 +00:00
parent c4bb8a1a8d
commit 7bd2d90a20

View File

@@ -2,10 +2,13 @@ package main
import (
"log"
"math/rand"
"time"
)
func main() {
rand.Seed(time.Now().UnixNano())
ac := NewAsanaClient()
sc := NewSlackClient()
@@ -14,10 +17,8 @@ func main() {
log.Printf("%s", err)
}
tick := time.NewTicker(60 * time.Second)
for {
<-tick.C
time.Sleep(time.Duration(rand.Intn(60)) * time.Second)
Poll(ac, sc)
}