diff --git a/pkg/monitor/models/notification.go b/pkg/monitor/models/notification.go index e4ed6466be..019f822bfb 100644 --- a/pkg/monitor/models/notification.go +++ b/pkg/monitor/models/notification.go @@ -237,7 +237,11 @@ func (n *SNotification) ShouldSendNotification() bool { if n.Frequency == 0 { return true } - if int64(time.Now().Sub(n.LastSendNotification)/time.Second)+int64(60) >= n.Frequency { + // 如果从未发送过通知(LastSendNotification 为零值),允许第一次发送 + if n.LastSendNotification.IsZero() { + return true + } + if int64(time.Since(n.LastSendNotification)/time.Second)+int64(60) >= n.Frequency { return true } return false