for fatal error (no such host), advance the retry clock

This commit is contained in:
Ted Unangst 2023-06-13 13:56:42 -04:00
parent dccbec5c8e
commit 712873418b
1 changed files with 12 additions and 0 deletions

View File

@ -19,6 +19,7 @@ import (
"bytes" "bytes"
"database/sql" "database/sql"
notrand "math/rand" notrand "math/rand"
"strings"
"sync" "sync"
"time" "time"
@ -60,6 +61,14 @@ func sayitagain(doover Doover) {
} }
} }
func lethaldose(err error) int64 {
str := err.Error()
if strings.Contains(str, "no such host") {
return 8
}
return 0
}
var dqmtx sync.Mutex var dqmtx sync.Mutex
func delinquent(userid int64, rcpt string, msg []byte) bool { func delinquent(userid int64, rcpt string, msg []byte) bool {
@ -132,6 +141,9 @@ func deliveration(doover Doover) {
err := PostMsg(ki.keyname, ki.seckey, inbox, msg) err := PostMsg(ki.keyname, ki.seckey, inbox, msg)
if err != nil { if err != nil {
ilog.Printf("failed to post json to %s: %s", inbox, err) ilog.Printf("failed to post json to %s: %s", inbox, err)
if t := lethaldose(err); t > doover.Tries {
doover.Tries = t
}
doover.Msgs = doover.Msgs[i:] doover.Msgs = doover.Msgs[i:]
sayitagain(doover) sayitagain(doover)
return return