Skip to content

Commit

Permalink
Merge: * /control/version.json: retry up to 3 times after DNS resolve…
Browse files Browse the repository at this point in the history
… of static.adguard.com has failed

Close AdguardTeam#934

* commit 'd4c012220edc52e7d47808f1d83ce9ca664f73d3':
  * control: add link to the issue on github
  * /control/version.json: retry up to 3 times after DNS resolve of static.adguard.com has failed
  • Loading branch information
szolin committed Aug 28, 2019
2 parents c7b5b00 + d4c0122 commit be3f855
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions home/control_update.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,17 @@ func handleGetVersionJSON(w http.ResponseWriter, r *http.Request) {
}
}

log.Tracef("Downloading data from %s", versionCheckURL)
resp, err := config.client.Get(versionCheckURL)
var resp *http.Response
for i := 0; i != 3; i++ {
log.Tracef("Downloading data from %s", versionCheckURL)
resp, err = config.client.Get(versionCheckURL)
if err != nil && strings.HasSuffix(err.Error(), "i/o timeout") {
// This case may happen while we're restarting DNS server
// https://github.com/AdguardTeam/AdGuardHome/issues/934
continue
}
break
}
if err != nil {
httpError(w, http.StatusBadGateway, "Couldn't get version check json from %s: %T %s\n", versionCheckURL, err, err)
return
Expand Down

0 comments on commit be3f855

Please sign in to comment.