1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 19:01:16 +02:00

HttpBinaryCacheStore: Retry on transient HTTP errors

This makes us more robust against 500 errors from CloudFront or S3
(assuming the 500 error isn't cached by CloudFront...).
This commit is contained in:
Eelco Dolstra 2016-08-10 16:06:33 +02:00
parent 9204ea7294
commit 66adbdfd97
3 changed files with 34 additions and 14 deletions

View file

@ -58,6 +58,7 @@ protected:
DownloadOptions options;
options.showProgress = DownloadOptions::no;
options.head = true;
options.tries = 5;
downloader->download(cacheUri + "/" + path, options);
return true;
} catch (DownloadError & e) {
@ -79,6 +80,7 @@ protected:
auto downloader(downloaders.get());
DownloadOptions options;
options.showProgress = DownloadOptions::no;
options.tries = 3;
try {
return downloader->download(cacheUri + "/" + path, options).data;
} catch (DownloadError & e) {