Merge pull request #9882 from rainzm/notify/error_panic

Fix Notifition about Panic_Error Send too much
This commit is contained in:
Zexi Li
2021-01-14 14:49:53 +08:00
committed by GitHub
3 changed files with 5 additions and 3 deletions

View File

@@ -977,12 +977,14 @@ func (rm *SReceiverManager) OnUpdate(oldObj, newObj *jsonutils.JSONDict) {
receiver := &receivers[0]
uname, _ := newObj.GetString("name")
domainId, _ := newObj.GetString("domain_id")
if receiver.Name == uname && receiver.DomainId == domainId {
lang, _ := newObj.GetString("lang")
if receiver.Name == uname && receiver.DomainId == domainId && receiver.Lang == lang {
return
}
_, err = db.Update(receiver, func() error {
receiver.Name = uname
receiver.DomainId = domainId
receiver.Lang = lang
return nil
})
if err != nil {

View File

@@ -31,7 +31,7 @@ type NotifyOption struct {
InitNotificationScope int `help:"initialize data of notification with in InitNotificationScope hours" default:"100"`
MaxSyncNotification int `help:"The max number of notification sync from old data source" default:"1000"`
VerifyExpireInterval int `help:"expire interval of verify message; minutes" default:"5"`
VerifyExpireInterval int `help:"expire interval of verify message; minutes" default:"2"`
VerifyValidInterval int `help:"valid interval of verify message; miniutes" default:"20"`
}

View File

@@ -175,7 +175,7 @@ func (self *NotificationSendTask) OnInit(ctx context.Context, obj db.IStandalone
// check result
for _, fd := range fds {
rn := contactMap[fd.Contact]
sendFail(rn, err.Error())
sendFail(rn, fd.Reason)
delete(contactMap, fd.Contact)
}
// after send for successful notify