aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/build/worker.cc
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-10-05 00:38:35 +0200
committereldritch horrors <pennae@lix.systems>2024-10-05 18:21:02 +0000
commit896a123605b825cd0a1548fc40da1a757ca30d25 (patch)
tree43a423d6797189c8cc1eeaeac59a0fe0a70c0b32 /src/libstore/build/worker.cc
parent86b213e6321540328fb11c3ea99c0b24becc45b0 (diff)
libstore: remove Goal::StillAlive
this was a triumph. i'm making a note here: huge success. it's hard to overstate my satisfaction! i'm not even angry. i'm being so sincere ri actually, no. we *are* angry. this was one dumbass odyssey. nobody has asked for this. but not doing it would have locked us into old, broken protocols forever or (possibly worse) forced us to write our own async framework building on the old did-you-mean-continuations in Worker. if we had done that we'd be locked into ever more, and ever more complex, manual state management all over the place. this just could not stand. Change-Id: I43a6de1035febff59d2eff83be9ad52af4659871
Diffstat (limited to 'src/libstore/build/worker.cc')
-rw-r--r--src/libstore/build/worker.cc18
1 files changed, 2 insertions, 16 deletions
diff --git a/src/libstore/build/worker.cc b/src/libstore/build/worker.cc
index e063ede71..0ca805b4d 100644
--- a/src/libstore/build/worker.cc
+++ b/src/libstore/build/worker.cc
@@ -193,7 +193,7 @@ static void removeGoal(std::shared_ptr<G> goal, auto & goalMap)
}
-void Worker::goalFinished(GoalPtr goal, Goal::Finished & f)
+void Worker::goalFinished(GoalPtr goal, Goal::WorkResult & f)
{
goal->trace("done");
assert(!goal->exitCode.has_value());
@@ -210,20 +210,6 @@ void Worker::goalFinished(GoalPtr goal, Goal::Finished & f)
goal->cleanup();
}
-void Worker::handleWorkResult(GoalPtr goal, Goal::WorkResult how)
-{
- std::visit(
- overloaded{
- [&](Goal::StillAlive) {
- childStarted(goal, kj::evalLater([goal] { return goal->work(); }));
- },
- [&](Goal::Finished & f) { goalFinished(goal, f); },
- },
- how
- );
- updateStatistics();
-}
-
void Worker::removeGoal(GoalPtr goal)
{
if (auto drvGoal = std::dynamic_pointer_cast<DerivationGoal>(goal))
@@ -250,7 +236,7 @@ void Worker::childStarted(GoalPtr goal, kj::Promise<Result<Goal::WorkResult>> pr
children.add(promise
.then([this, goal](auto result) {
if (result.has_value()) {
- handleWorkResult(goal, std::move(result.assume_value()));
+ goalFinished(goal, result.assume_value());
} else {
childException = result.assume_error();
}