mirror of
https://github.com/Icinga/icingadb.git
synced 2026-05-28 04:35:54 -04:00
Use time.NewTicker(), not time.Tick()
This commit is contained in:
parent
5a084ba7a9
commit
35349262ce
1 changed files with 4 additions and 2 deletions
|
|
@ -84,7 +84,9 @@ func (h Heartbeat) controller() {
|
|||
// Message producer loop
|
||||
g.Go(func() error {
|
||||
// We expect heartbeats every second but only read them every 3 seconds
|
||||
throttle := time.Tick(time.Second * 3)
|
||||
throttle := time.NewTicker(time.Second * 3)
|
||||
defer throttle.Stop()
|
||||
|
||||
for {
|
||||
cmd := h.client.XRead(ctx, &redis.XReadArgs{
|
||||
Streams: []string{"icinga:stats", "$"},
|
||||
|
|
@ -102,7 +104,7 @@ func (h Heartbeat) controller() {
|
|||
return ctx.Err()
|
||||
}
|
||||
|
||||
<-throttle
|
||||
<-throttle.C
|
||||
}
|
||||
})
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue