From 815489c0ffbf66a048b2f4797824829e8d887d8f Mon Sep 17 00:00:00 2001 From: Simon Zolin Date: Mon, 26 Aug 2019 16:02:56 +0300 Subject: [PATCH 1/2] * /control/version.json: retry up to 3 times after DNS resolve of static.adguard.com has failed --- home/control_update.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/home/control_update.go b/home/control_update.go index 163c3acd..ca2ac63e 100644 --- a/home/control_update.go +++ b/home/control_update.go @@ -85,8 +85,16 @@ 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 + continue + } + break + } if err != nil { httpError(w, http.StatusBadGateway, "Couldn't get version check json from %s: %T %s\n", versionCheckURL, err, err) return From d4c012220edc52e7d47808f1d83ce9ca664f73d3 Mon Sep 17 00:00:00 2001 From: Simon Zolin Date: Tue, 27 Aug 2019 11:53:09 +0300 Subject: [PATCH 2/2] * control: add link to the issue on github --- home/control_update.go | 1 + 1 file changed, 1 insertion(+) diff --git a/home/control_update.go b/home/control_update.go index ca2ac63e..92c82f1e 100644 --- a/home/control_update.go +++ b/home/control_update.go @@ -91,6 +91,7 @@ func handleGetVersionJSON(w http.ResponseWriter, r *http.Request) { 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