libstore: set connect-timeout to 5
Right now, Lix waits for quite a while five times[1] if a substituter is down. If the substituter is not reachable for that long, it's probably down or so slow that it doesn't make sense to download from it. Also, most people would abort earlier assuming that Lix just behaves weird in that case. Reducing the timeout to 5s to make the behavior a little better. If people live in areas with poor connection where a higher timeout would be appropriate, I'd argue that they should increase the timeout rather than requiring everbody else to set it to a non-zero value. Additionally, communicate how often we're re-trying. [1] Because of `download-attempts` from `nix.conf(5)` Change-Id: I8500dce0c8230247dd492e43cc7af4d3b58c4710
This commit is contained in:
@@ -0,0 +1,10 @@
|
||||
---
|
||||
synopsis: Set default of `connect-timeout` to `5`
|
||||
issues: []
|
||||
cls: [2799]
|
||||
category: Miscellany
|
||||
credits: [ma27]
|
||||
---
|
||||
|
||||
By default, the connection timeout to substituters is now 5s instead of 300s.
|
||||
That way, unavailable substituters are detected quicker.
|
||||
@@ -2,7 +2,7 @@
|
||||
name: connect-timeout
|
||||
internalName: connectTimeout
|
||||
type: unsigned long
|
||||
default: 0
|
||||
default: 5
|
||||
---
|
||||
The timeout (in seconds) for establishing connections in the
|
||||
binary cache substituter. It corresponds to `curl`’s
|
||||
|
||||
@@ -889,9 +889,9 @@ struct curlFileTransfer : public FileTransfer
|
||||
std::uniform_real_distribution<> dist(0.0, 0.5);
|
||||
int ms = parent.baseRetryTimeMs * std::pow(2.0f, attempt - 1 + dist(random));
|
||||
if (totalReceived) {
|
||||
warn("%s; retrying from offset %d in %d ms", context, totalReceived, ms);
|
||||
warn("%s; retrying from offset %d in %d ms (attempt %d/%d)", context, totalReceived, ms, attempt, tries);
|
||||
} else {
|
||||
warn("%s; retrying in %d ms", context, ms);
|
||||
warn("%s; retrying in %d ms (attempt %d/%d)", context, ms, attempt, tries);
|
||||
}
|
||||
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(ms));
|
||||
|
||||
Reference in New Issue
Block a user