Fix ban when warnings have errors

master
Robert Jacob 2022-03-21 23:32:18 +01:00
parent a239d4616f
commit 4f3049554a
2 changed files with 8 additions and 0 deletions

View File

@ -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)
}

View File

@ -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