Skip to content

Commit

Permalink
Use ticker instead of sleeping.
Browse files Browse the repository at this point in the history
Signed-off-by: Cody Littley <[email protected]>
  • Loading branch information
cody-littley committed Nov 22, 2024
1 parent 2d6c116 commit fbc7bc1
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion common/metrics/metrics_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,11 @@ func (m *metrics) NewAutoGauge(
}

pollingAgent := func() {
ticker := time.NewTicker(pollPeriod)
for m.isAlive.Load() {
value := source()
gauge.Set(value)
time.Sleep(pollPeriod)
<-ticker.C
}
}

Expand Down

0 comments on commit fbc7bc1

Please sign in to comment.