mirror of
https://github.com/prometheus/prometheus.git
synced 2024-11-13 09:04:06 -08:00
[storage/local] fix timer.Reset usage
According to https://golang.org/pkg/time/#Timer.Reset you must not rely on a returned value from Reset. Signed-off-by: Alexander Morozov <lk4d4math@gmail.com>
This commit is contained in:
parent
a03193232a
commit
7e814ada72
|
@ -998,7 +998,8 @@ func (s *MemorySeriesStorage) logThrottling() {
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case <-s.throttled:
|
case <-s.throttled:
|
||||||
if !timer.Reset(time.Minute) {
|
if !timer.Stop() {
|
||||||
|
<-timer.C
|
||||||
score, _ := s.getPersistenceUrgencyScore()
|
score, _ := s.getPersistenceUrgencyScore()
|
||||||
log.
|
log.
|
||||||
With("urgencyScore", score).
|
With("urgencyScore", score).
|
||||||
|
@ -1006,6 +1007,7 @@ func (s *MemorySeriesStorage) logThrottling() {
|
||||||
With("memoryChunks", atomic.LoadInt64(&chunk.NumMemChunks)).
|
With("memoryChunks", atomic.LoadInt64(&chunk.NumMemChunks)).
|
||||||
Error("Storage needs throttling. Scrapes and rule evaluations will be skipped.")
|
Error("Storage needs throttling. Scrapes and rule evaluations will be skipped.")
|
||||||
}
|
}
|
||||||
|
timer.Reset(time.Minute)
|
||||||
case <-timer.C:
|
case <-timer.C:
|
||||||
score, _ := s.getPersistenceUrgencyScore()
|
score, _ := s.getPersistenceUrgencyScore()
|
||||||
log.
|
log.
|
||||||
|
|
Loading…
Reference in a new issue