the number of unreliable servers in the federation is too damn high!

This commit is contained in:
Ted Unangst 2019-05-21 19:09:28 -04:00
parent 1d97b24c82
commit fc4f13d9e0
1 changed files with 6 additions and 1 deletions

View File

@ -136,9 +136,14 @@ func GetJunk(url string) (map[string]interface{}, error) {
req.Header.Set("Accept-Encoding", "gzip")
req.Header.Set("User-Agent", "honksnonk/5.0")
resp, err := client.Do(req)
if err != nil {
log.Printf("first get failed: %s", err)
resp, err = client.Do(req)
if err != nil {
return nil, err
}
log.Printf("retry succeeded!")
}
if resp.StatusCode != 200 {
resp.Body.Close()
return nil, fmt.Errorf("http get status: %d", resp.StatusCode)