From aa33c34c9be074c9452976aa96d71091325c83ea Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Wed, 25 Sep 2024 23:57:46 +0200 Subject: [PATCH] libstore: merge ContinueImmediately and StillAlive nothing needs to signal being still active but not actively pollable, only that immediate polling for the next goal work phase is in order. Change-Id: Ia43c1015e94ba4f5f6b9cb92943da608c4a01555 --- src/libstore/build/derivation-goal.cc | 2 +- src/libstore/build/drv-output-substitution-goal.cc | 2 +- src/libstore/build/goal.cc | 6 +++--- src/libstore/build/goal.hh | 2 -- src/libstore/build/substitution-goal.cc | 2 +- src/libstore/build/worker.cc | 3 +-- 6 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/libstore/build/derivation-goal.cc b/src/libstore/build/derivation-goal.cc index f28285ad8..b4f3aaf6f 100644 --- a/src/libstore/build/derivation-goal.cc +++ b/src/libstore/build/derivation-goal.cc @@ -1751,7 +1751,7 @@ DerivationGoal::continueOrError(kj::Promise> p) { return p.then([](auto r) -> Result { if (r.has_value()) { - return ContinueImmediately{}; + return StillAlive{}; } else if (r.has_error()) { return r.assume_error(); } else { diff --git a/src/libstore/build/drv-output-substitution-goal.cc b/src/libstore/build/drv-output-substitution-goal.cc index 846268a3a..87a8b0c55 100644 --- a/src/libstore/build/drv-output-substitution-goal.cc +++ b/src/libstore/build/drv-output-substitution-goal.cc @@ -86,7 +86,7 @@ try { }); state = &DrvOutputSubstitutionGoal::realisationFetched; - return pipe.promise.then([]() -> Result { return ContinueImmediately{}; }); + return pipe.promise.then([]() -> Result { return StillAlive{}; }); } catch (...) { return {std::current_exception()}; } diff --git a/src/libstore/build/goal.cc b/src/libstore/build/goal.cc index 957bc2aaf..cfdb6717c 100644 --- a/src/libstore/build/goal.cc +++ b/src/libstore/build/goal.cc @@ -17,7 +17,7 @@ try { /* If we are polling goals that are waiting for a lock, then wake up after a few seconds at most. */ co_await worker.aio.provider->getTimer().afterDelay(settings.pollInterval.get() * kj::SECONDS); - co_return ContinueImmediately{}; + co_return StillAlive{}; } catch (...) { co_return std::current_exception(); } @@ -45,11 +45,11 @@ try { waiteeDone(dep); if (dep->exitCode == ecFailed && !settings.keepGoing) { - co_return result::success(ContinueImmediately{}); + co_return result::success(StillAlive{}); } } - co_return result::success(ContinueImmediately{}); + co_return result::success(StillAlive{}); } catch (...) { co_return result::failure(std::current_exception()); } diff --git a/src/libstore/build/goal.hh b/src/libstore/build/goal.hh index 4436e44b1..17c3d85db 100644 --- a/src/libstore/build/goal.hh +++ b/src/libstore/build/goal.hh @@ -103,7 +103,6 @@ public: struct Finished; struct [[nodiscard]] StillAlive {}; - struct [[nodiscard]] ContinueImmediately {}; struct [[nodiscard]] Finished { ExitCode exitCode; BuildResult result; @@ -116,7 +115,6 @@ public: struct [[nodiscard]] WorkResult : std::variant< StillAlive, - ContinueImmediately, Finished> { WorkResult() = delete; diff --git a/src/libstore/build/substitution-goal.cc b/src/libstore/build/substitution-goal.cc index d9d8f1a7d..cbbd9daf2 100644 --- a/src/libstore/build/substitution-goal.cc +++ b/src/libstore/build/substitution-goal.cc @@ -240,7 +240,7 @@ try { }); state = &PathSubstitutionGoal::finished; - return pipe.promise.then([]() -> Result { return ContinueImmediately{}; }); + return pipe.promise.then([]() -> Result { return StillAlive{}; }); } catch (...) { return {std::current_exception()}; } diff --git a/src/libstore/build/worker.cc b/src/libstore/build/worker.cc index 94a638725..b23b2800e 100644 --- a/src/libstore/build/worker.cc +++ b/src/libstore/build/worker.cc @@ -212,8 +212,7 @@ void Worker::handleWorkResult(GoalPtr goal, Goal::WorkResult how) { std::visit( overloaded{ - [&](Goal::StillAlive) {}, - [&](Goal::ContinueImmediately) { wakeUp(goal); }, + [&](Goal::StillAlive) { wakeUp(goal); }, [&](Goal::Finished & f) { goalFinished(goal, f); }, }, how