log.Infof("found and locked a notification: %s",notification.Name)
log.WithField(logNotiName,notification.Name).Info("found and locked a notification")
return¬ification
}
}
@ -150,13 +154,13 @@ func handleTask(n database.VulnerabilityNotification, st *stopper.Stopper, maxAt
for{
// Max attempts exceeded.
ifattempts>=maxAttempts{
log.Infof("giving up on sending notification '%s' via sender '%s': max attempts exceeded (%d)\n",n.Name,senderName,maxAttempts)
log.WithFields(log.Fields{logNotiName:n.Name,logSenderName:senderName,"max attempts":maxAttempts}).Info("giving up on sending notification : max attempts exceeded")
returnfalse,false
}
// Backoff.
ifbackOff>0{
log.Infof("waiting %v before retrying to send notification '%s' via sender '%s' (Attempt %d / %d)\n",backOff,n.Name,senderName,attempts+1,maxAttempts)
log.WithFields(log.Fields{"duration":backOff,logNotiName:n.Name,logSenderName:senderName,"attempts":attempts+1,"max attempts":maxAttempts}).Info("waiting before retrying to send notification")
if!st.Sleep(backOff){
returnfalse,true
}
@ -166,7 +170,7 @@ func handleTask(n database.VulnerabilityNotification, st *stopper.Stopper, maxAt
iferr:=sender.Send(n);err!=nil{
// Send failed; increase attempts/backoff and retry.