queue: Fix misuse of TriesCount

This commit is contained in:
fox.cpp 2020-03-07 01:29:50 +03:00
parent 4b3e7ce819
commit ceda7259c0
No known key found for this signature in database
GPG key ID: E76D97CCEDE90B6C

View file

@ -375,7 +375,7 @@ func (q *Queue) tryDelivery(meta *QueueMetadata, header textproto.Header, body b
for _, rcpt := range meta.To {
rcptErr, ok := partialErr.Errs[rcpt]
if !ok {
dl.Msg("delivered", "rcpt", rcpt, "attempt", meta.TriesCount[rcpt])
dl.Msg("delivered", "rcpt", rcpt, "attempt", meta.TriesCount[rcpt]+1)
continue
}
@ -384,7 +384,7 @@ func (q *Queue) tryDelivery(meta *QueueMetadata, header textproto.Header, body b
meta.RcptErrs[rcpt] = toSMTPErr(rcptErr)
temporary := exterrors.IsTemporaryOrUnspec(rcptErr)
if !temporary || meta.TriesCount[rcpt] == q.maxTries {
if !temporary || meta.TriesCount[rcpt]+1 == q.maxTries {
delete(meta.TriesCount, rcpt)
dl.Msg("not delivered, permanent error", "rcpt", rcpt)
failedRcpts = append(failedRcpts, rcpt)