for fatal error (no such host), advance the retry clock
Ted Unangst tedu@tedunangst.com
Tue, 13 Jun 2023 13:56:42 -0400
1 files changed,
12 insertions(+),
0 deletions(-)
jump to
M
deliverator.go
→
deliverator.go
@@ -19,6 +19,7 @@ import (
"bytes" "database/sql" notrand "math/rand" + "strings" "sync" "time"@@ -58,6 +59,14 @@ select {
case pokechan <- 0: default: } +} + +func lethaldose(err error) int64 { + str := err.Error() + if strings.Contains(str, "no such host") { + return 8 + } + return 0 } var dqmtx sync.Mutex@@ -132,6 +141,9 @@ }
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