just sleep if we get error 502

This commit is contained in:
Ted Unangst 2020-09-25 18:46:15 -04:00
parent ae0fc63030
commit e1cff81b4c
1 changed files with 5 additions and 0 deletions

View File

@ -41,6 +41,11 @@ func gethonks(server, token string, wanted int) HonkSet {
} }
defer resp.Body.Close() defer resp.Body.Close()
if resp.StatusCode != 200 { 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) answer, _ := ioutil.ReadAll(resp.Body)
log.Fatalf("status: %d: %s", resp.StatusCode, answer) log.Fatalf("status: %d: %s", resp.StatusCode, answer)
} }