diff options
Diffstat (limited to 'src/libstore/build/goal.cc')
-rw-r--r-- | src/libstore/build/goal.cc | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/libstore/build/goal.cc b/src/libstore/build/goal.cc index 8a2f4ab35..5f0ed485c 100644 --- a/src/libstore/build/goal.cc +++ b/src/libstore/build/goal.cc @@ -33,18 +33,22 @@ kj::Promise<Result<Goal::WorkResult>> Goal::waitForGoals(kj::Array<std::pair<GoalPtr, kj::Promise<void>>> dependencies) noexcept try { auto left = dependencies.size(); + for (auto & [dep, p] : dependencies) { + p = p.then([this, dep, &left] { + left--; + trace(fmt("waitee '%s' done; %d left", dep->name, left)); + + if (dep->exitCode != Goal::ecSuccess) ++nrFailed; + if (dep->exitCode == Goal::ecNoSubstituters) ++nrNoSubstituters; + if (dep->exitCode == Goal::ecIncompleteClosure) ++nrIncompleteClosure; + }).eagerlyEvaluate(nullptr); + } + auto collectDeps = asyncCollect(std::move(dependencies)); while (auto item = co_await collectDeps.next()) { - left--; auto & dep = *item; - trace(fmt("waitee '%s' done; %d left", dep->name, left)); - - if (dep->exitCode != Goal::ecSuccess) ++nrFailed; - if (dep->exitCode == Goal::ecNoSubstituters) ++nrNoSubstituters; - if (dep->exitCode == Goal::ecIncompleteClosure) ++nrIncompleteClosure; - waiteeDone(dep); if (dep->exitCode == ecFailed && !settings.keepGoing) { |