just sleep if we get error 502
Ted Unangst tedu@tedunangst.com
Fri, 25 Sep 2020 18:46:15 -0400
1 files changed,
5 insertions(+),
0 deletions(-)
jump to
M
toys/autobonker.go
→
toys/autobonker.go
@@ -41,6 +41,11 @@ log.Fatal(err)
} defer resp.Body.Close() if resp.StatusCode != 200 { + if resp.StatusCode == 502 { + log.Printf("server error 502...") + time.Sleep(5 * time.Minute) + return HonkSet{} + } answer, _ := ioutil.ReadAll(resp.Body) log.Fatalf("status: %d: %s", resp.StatusCode, answer) }