From 712873418b46324dd1120f65114843e3d1630ff3 Mon Sep 17 00:00:00 2001 From: Ted Unangst Date: Tue, 13 Jun 2023 13:56:42 -0400 Subject: [PATCH] for fatal error (no such host), advance the retry clock --- deliverator.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/deliverator.go b/deliverator.go index 77ddca0..814c2f0 100644 --- a/deliverator.go +++ b/deliverator.go @@ -19,6 +19,7 @@ import ( "bytes" "database/sql" notrand "math/rand" + "strings" "sync" "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 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) if err != nil { 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:] sayitagain(doover) return