mirror of
https://github.com/Buriburizaem0n/nezha_domains.git
synced 2026-02-04 04:30:05 +00:00
bug fixes (#918)
* bug fixes * fix for backward compatibility * fix init * cleanup * possible fix * optimize permission check * Revert "possible fix" This reverts commit 003f1bbb2aa368aade6702e6019922b7f4871a39.
This commit is contained in:
@@ -62,13 +62,9 @@ func (r *AlertRule) Enabled() bool {
|
||||
}
|
||||
|
||||
// Snapshot 对传入的Server进行该报警规则下所有type的检查 返回每项检查结果
|
||||
func (r *AlertRule) Snapshot(cycleTransferStats *CycleTransferStats, server *Server, db *gorm.DB, role uint8) []bool {
|
||||
func (r *AlertRule) Snapshot(cycleTransferStats *CycleTransferStats, server *Server, db *gorm.DB) []bool {
|
||||
point := make([]bool, len(r.Rules))
|
||||
|
||||
if r.UserID != server.UserID && role != RoleAdmin {
|
||||
return point
|
||||
}
|
||||
|
||||
for i, rule := range r.Rules {
|
||||
point[i] = rule.Snapshot(cycleTransferStats, server, db)
|
||||
}
|
||||
@@ -85,8 +81,8 @@ func (r *AlertRule) Check(points [][]bool) (maxDuration int, passed bool) {
|
||||
if maxDuration < 1 {
|
||||
maxDuration = 1
|
||||
}
|
||||
for j := len(points[i]) - 1; j >= 0; j-- {
|
||||
if !points[i][j] {
|
||||
for j := len(points) - 1; j >= 0; j-- {
|
||||
if !points[j][i] {
|
||||
failCount++
|
||||
break
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user