mirror of
https://github.com/nezhahq/nezha.git
synced 2025-01-23 05:08:13 -05:00
parent
36d00f58a2
commit
b07bfdf63d
@ -1,8 +1,6 @@
|
|||||||
package model
|
package model
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"slices"
|
|
||||||
|
|
||||||
"github.com/nezhahq/nezha/pkg/utils"
|
"github.com/nezhahq/nezha/pkg/utils"
|
||||||
"gorm.io/gorm"
|
"gorm.io/gorm"
|
||||||
)
|
)
|
||||||
@ -83,13 +81,10 @@ func (r *AlertRule) Check(points [][]bool) (maxDuration int, passed bool) {
|
|||||||
if maxDuration < 1 {
|
if maxDuration < 1 {
|
||||||
maxDuration = 1
|
maxDuration = 1
|
||||||
}
|
}
|
||||||
LOOP:
|
for j := len(points) - 1; j >= 0; j-- {
|
||||||
for _, point := range points {
|
if !points[j][i] {
|
||||||
for _, check := range slices.Backward(point) {
|
failCount++
|
||||||
if !check {
|
break
|
||||||
failCount++
|
|
||||||
break LOOP
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user