We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent c54bca0 commit ce8f84aCopy full SHA for ce8f84a
pkg/monitor/models/notification.go
@@ -237,7 +237,11 @@ func (n *SNotification) ShouldSendNotification() bool {
237
if n.Frequency == 0 {
238
return true
239
}
240
- if int64(time.Now().Sub(n.LastSendNotification)/time.Second)+int64(60) >= n.Frequency {
+ // 如果从未发送过通知(LastSendNotification 为零值),允许第一次发送
241
+ if n.LastSendNotification.IsZero() {
242
+ return true
243
+ }
244
+ if int64(time.Since(n.LastSendNotification)/time.Second)+int64(60) >= n.Frequency {
245
246
247
return false
0 commit comments