Skip to content

Commit 989d79b

Browse files
Merge pull request #4119 from evkuzin/fix_time_now_enormous_overhead
replace Resolved with ResolvedAt to reduce amount call to time.Now()
2 parents 71c4b6b + 79db5fd commit 989d79b

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

inhibit/inhibit.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,10 +230,11 @@ func NewInhibitRule(cr config.InhibitRule) *InhibitRule {
230230
// is returned. If excludeTwoSidedMatch is true, alerts that match both the
231231
// source and the target side of the rule are disregarded.
232232
func (r *InhibitRule) hasEqual(lset model.LabelSet, excludeTwoSidedMatch bool) (model.Fingerprint, bool) {
233+
now := time.Now()
233234
Outer:
234235
for _, a := range r.scache.List() {
235236
// The cache might be stale and contain resolved alerts.
236-
if a.Resolved() {
237+
if a.ResolvedAt(now) {
237238
continue
238239
}
239240
for n := range r.Equal {

0 commit comments

Comments
 (0)