Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions src/libstore/build/substitution-goal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -110,18 +110,12 @@ void PathSubstitutionGoal::tryNext()
tryNext();
return;
} catch (SubstituterDisabled &) {
if (settings.tryFallback) {
tryNext();
return;
}
throw;
tryNext();
Copy link
Member

@Ericson2314 Ericson2314 Apr 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So I think what we need to do is stash the error (in a new substitution goal variable) here. And then at the end of the function, we re-throw the error instead of returning if nothing is found.

Does it make sense how that brings us in alignment with the spec I wrote?

return;
} catch (Error & e) {
if (settings.tryFallback) {
logError(e.info());
tryNext();
return;
}
throw;
logError(e.info());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto, not sure if we should log here, or log at the end if we don't end up re-throwing.

tryNext();
return;
}

if (info->path != storePath) {
Expand Down
2 changes: 1 addition & 1 deletion src/libstore/http-binary-cache-store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class HttpBinaryCacheStore : public virtual HttpBinaryCacheStoreConfig, public v
void maybeDisable()
{
auto state(_state.lock());
if (state->enabled && settings.tryFallback) {
if (state->enabled) {
int t = 60;
printError("disabling binary cache '%s' for %s seconds", getUri(), t);
state->enabled = false;
Expand Down
5 changes: 1 addition & 4 deletions src/libstore/local-store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1158,10 +1158,7 @@ void LocalStore::querySubstitutablePathInfos(const StorePathCAMap & paths, Subst
} catch (InvalidPath &) {
} catch (SubstituterDisabled &) {
} catch (Error & e) {
if (settings.tryFallback)
logError(e.info());
else
throw;
logError(e.info());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ditto

}
}
}
Expand Down