diff --git a/src/libstore/download.cc b/src/libstore/download.cc index 13c665a40ca80508b9bdf5b0d8f564c0c2392a23..5305a48950c4b478af6b7fe6a6c616fd91b92bce 100644 --- a/src/libstore/download.cc +++ b/src/libstore/download.cc @@ -230,7 +230,7 @@ struct CurlDownloader : public Downloader } catch (DownloadError & e) { attempt++; if (e.error != Transient || attempt >= options.tries) throw; - auto ms = 25 * (1 << (attempt - 1)); + auto ms = options.baseRetryTimeMs * (1 << (attempt - 1)); printMsg(lvlError, format("warning: %s; retrying in %d ms") % e.what() % ms); std::this_thread::sleep_for(std::chrono::milliseconds(ms)); } diff --git a/src/libstore/download.hh b/src/libstore/download.hh index 08618ba1c95d6f055066463538d9e21163c5d6ce..f22e688645b0ad9c609102aa42f1dd423d8d79a3 100644 --- a/src/libstore/download.hh +++ b/src/libstore/download.hh @@ -14,6 +14,7 @@ struct DownloadOptions enum { yes, no, automatic } showProgress = yes; bool head = false; size_t tries = 1; + unsigned int baseRetryTimeMs = 100; }; struct DownloadResult diff --git a/src/libstore/http-binary-cache-store.cc b/src/libstore/http-binary-cache-store.cc index 42e9099b8e20933ccc86d676aad01e7910561d24..bdcd2fd3998b6ca712d455a39ebdd8a29fdf4c12 100644 --- a/src/libstore/http-binary-cache-store.cc +++ b/src/libstore/http-binary-cache-store.cc @@ -80,7 +80,8 @@ protected: auto downloader(downloaders.get()); DownloadOptions options; options.showProgress = DownloadOptions::no; - options.tries = 3; + options.tries = 5; + options.baseRetryTimeMs = 1000; try { return downloader->download(cacheUri + "/" + path, options).data; } catch (DownloadError & e) {