fix(monitor): check if LastSendNotification is zero (#23782)

This commit is contained in:
Zexi Li
2025-11-20 18:04:10 +08:00
committed by GitHub
parent c54bca0874
commit ce8f84add6
+5 -1
View File
@@ -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