Merge: * /control/version.json: retry up to 3 times after DNS resolve of static.adguard.com has failed
Close #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
This commit is contained in:
commit
be3f855df2
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue