all repos — honk @ fad3fea5abdff2668f3f318802628fd55fc423d0

my fork of honk

better log message for get timeout, and handle 429 retry
Ted Unangst tedu@tedunangst.com
Sun, 24 Dec 2023 13:49:51 -0500
commit

fad3fea5abdff2668f3f318802628fd55fc423d0

parent

ec6d70619f491d2dc91915d27f0b0ff29feffe5d

1 files changed, 4 insertions(+), 3 deletions(-)

jump to
M activity.goactivity.go

@@ -120,12 +120,13 @@ func GetJunkHardMode(userid int64, url string) (junk.Junk, error) {

j, err := GetJunk(userid, url) if err != nil { emsg := err.Error() - if emsg == "http get status: 502" || strings.Contains(emsg, "timeout") { - ilog.Printf("trying again after error: %s", emsg) + if emsg == "http get status: 429" || emsg == "http get status: 502" || + strings.Contains(emsg, "timeout") { + ilog.Printf("trying %s again after error: %s", url, emsg) time.Sleep(time.Duration(60+notrand.Int63n(60)) * time.Second) j, err = GetJunk(userid, url) if err != nil { - ilog.Printf("still couldn't get it") + ilog.Printf("still couldn't get %s", url) } else { ilog.Printf("retry success!") }