1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-24 13:51:16 +02:00
This commit is contained in:
Philip Wilk 2025-06-21 08:09:57 +02:00 committed by GitHub
commit 02e8b39886
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 28 additions and 12 deletions

View file

@ -80,14 +80,22 @@ Goal::Co PathSubstitutionGoal::init()
continue;
}
auto path = subPath ? *subPath : storePath;
try {
// FIXME: make async
info = sub->queryPathInfo(subPath ? *subPath : storePath);
info = sub->queryPathInfo(path);
} catch (InvalidPath &) {
continue;
// Because the substituter has failed recently
} catch (SubstituterDisabled & e) {
if (settings.tryFallback) continue;
else throw e;
/* This is also VERY spammy
warn(
"Substituter '%s' was disabled when getting info for path '%s'",
sub->getUri(),
sub->printStorePath(path));
*/
continue;
// Any other error
} catch (Error & e) {
if (settings.tryFallback) {
logError(e.info());

View file

@ -97,12 +97,10 @@ protected:
void maybeDisable()
{
auto state(_state.lock());
if (state->enabled && settings.tryFallback) {
int t = 60;
printError("disabling binary cache '%s' for %s seconds", getUri(), t);
state->enabled = false;
state->disabledUntil = std::chrono::steady_clock::now() + std::chrono::seconds(t);
}
int t = 60;
warn("disabling binary cache '%s' for %s seconds", getUri(), t);
state->enabled = false;
state->disabledUntil = std::chrono::steady_clock::now() + std::chrono::seconds(t);
}
void checkEnabled()

View file

@ -520,7 +520,8 @@ StorePathSet Store::queryDerivationOutputs(const StorePath & path)
void Store::querySubstitutablePathInfos(const StorePathCAMap & paths, SubstitutablePathInfos & infos)
{
if (!settings.useSubstitutes) return;
for (auto & sub : getDefaultSubstituters()) {
auto substituters = getDefaultSubstituters();
for (auto & sub : substituters) {
for (auto & path : paths) {
if (infos.count(path.first))
// Choose first succeeding substituter.
@ -557,10 +558,19 @@ void Store::querySubstitutablePathInfos(const StorePathCAMap & paths, Substituta
} catch (InvalidPath &) {
} catch (SubstituterDisabled &) {
} catch (Error & e) {
if (settings.tryFallback)
// if last substituter, THEN log error and throw, otherwise warn
if (&sub == &substituters.back() && !settings.tryFallback) {
logError(e.info());
else
throw;
} else {
/* This gets VERY spammy
warn( "Unable to download '%s' from subsituter '%s'\n%s",
sub->printStorePath(subPath),
sub->getUri(),
e.message());
*/
continue;
}
}
}
}