Skip to content

Commit

Permalink
replace Resolved with ResolvedAt to reduce amount of times we call ti…
Browse files Browse the repository at this point in the history
…me.Now() to 1 per iteration

Signed-off-by: Evgeny Kuzin <evgeny.kuzin@outlook.com>
  • Loading branch information
evkuzin authored and Evgeny Kuzin committed Nov 13, 2024
1 parent f6b942c commit 7f0c30b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion inhibit/inhibit.go
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,10 @@ func NewInhibitRule(cr config.InhibitRule) *InhibitRule {
// source and the target side of the rule are disregarded.
func (r *InhibitRule) hasEqual(lset model.LabelSet, excludeTwoSidedMatch bool) (model.Fingerprint, bool) {
Outer:
now := time.Now()
for _, a := range r.scache.List() {
// The cache might be stale and contain resolved alerts.
if a.Resolved() {
if a.ResolvedAt(now) {
continue
}
for n := range r.Equal {
Expand Down

0 comments on commit 7f0c30b

Please sign in to comment.