mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
fix(monitor): check if LastSendNotification is zero (#23782)
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user