Merge "libstore: set connect-timeout to 5" into main

This commit is contained in:
Maximilian Bosch
2025-03-16 18:09:30 +00:00
committed by Lix Systems Gerrit
3 changed files with 13 additions and 3 deletions
@@ -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
+2 -2
View File
@@ -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));