Fix ban when warnings have errors

master
Robert Jacob 9 months ago
parent a239d4616f
commit 4f3049554a
  1. 7
      internal/leaky/bucket.go
  2. 1
      internal/ruler/ruler.go

@ -48,3 +48,10 @@ func (b *Bucket) Push(timeStamp time.Time, id string) (level int, ok bool) {
level = len(newItems)
return level, level <= b.Threshold
}
func (b *Bucket) Reset(id string) {
b.Lock()
defer b.Unlock()
delete(b.Entries, id)
}

@ -129,6 +129,7 @@ func (r *Ruler) PushEvent(ts time.Time, id string) error {
logLine.Info("User warned.")
} else {
logLine.WithError(err).Error("Error setting warning.")
r.banBucket.Reset(id)
}
return nil

Loading…
Cancel
Save