fix: ignore the duration of out-of-bound rules (#1019)

This commit is contained in:
UUBulb
2025-03-07 20:23:18 +08:00
committed by GitHub
parent 731bc9521a
commit 79884c781a
2 changed files with 313 additions and 3 deletions

View File

@@ -109,12 +109,12 @@ func (r *AlertRule) Check(points [][]bool) (int, bool) {
continue
} else {
// 常规报警
if duration > durations[ruleIndex] {
durations[ruleIndex] = duration
}
if hasPassedRule = boundCheck(len(points), duration, hasPassedRule); hasPassedRule {
continue
}
if duration > durations[ruleIndex] {
durations[ruleIndex] = duration
}
total, fail := duration, 0
for timeTick := len(points) - duration; timeTick < len(points); timeTick++ {
if !points[timeTick][ruleIndex] {