From 003f1bbb2aa368aade6702e6019922b7f4871a39 Mon Sep 17 00:00:00 2001 From: uubulb Date: Thu, 26 Dec 2024 22:55:25 +0800 Subject: [PATCH] possible fix --- model/alertrule.go | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/model/alertrule.go b/model/alertrule.go index 27e6531..829722a 100644 --- a/model/alertrule.go +++ b/model/alertrule.go @@ -1,6 +1,8 @@ package model import ( + "slices" + "github.com/nezhahq/nezha/pkg/utils" "gorm.io/gorm" ) @@ -88,10 +90,13 @@ func (r *AlertRule) Check(points [][]bool) (maxDuration int, passed bool) { if maxDuration < 1 { maxDuration = 1 } - for j := len(points) - 1; j >= 0; j-- { - if !points[j][i] { - failCount++ - break + LOOP: + for _, point := range points { + for _, check := range slices.Backward(point) { + if !check { + failCount++ + break LOOP + } } } } else {