diff --git a/src/libstore/build/substitution-goal.cc b/src/libstore/build/substitution-goal.cc index 9ffc8219d..bd8d200fb 100644 --- a/src/libstore/build/substitution-goal.cc +++ b/src/libstore/build/substitution-goal.cc @@ -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()); diff --git a/src/libstore/http-binary-cache-store.cc b/src/libstore/http-binary-cache-store.cc index e44d146b9..7fa9203b5 100644 --- a/src/libstore/http-binary-cache-store.cc +++ b/src/libstore/http-binary-cache-store.cc @@ -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() diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 296f2251a..08fd02489 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -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; + } } } }