aboutsummaryrefslogtreecommitdiff
path: root/src/libstore
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 21:19:51 +0000
commited9b7f4f84fd60ad8618645cc1bae2d686ff0db6 (patch)
tree2ffd84b0fa2122ac409c0a08f8696216e2124341 /src/libstore
parent649d8cd08fa16c71e3580f16d77c2122540f3195 (diff)
libstore: remove Worker::{childStarted, goalFinished}
these two functions are now nearly trivial and much better inline into makeGoalCommon. keeping them separate also separates information about goal completion flows and how failure information ends up in `Worker`. Change-Id: I6af86996e4a2346583371186595e3013c88fb082
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/build/worker.cc30
-rw-r--r--src/libstore/build/worker.hh7
2 files changed, 9 insertions, 28 deletions
diff --git a/src/libstore/build/worker.cc b/src/libstore/build/worker.cc
index 82acbdb3d..7fc6198cf 100644
--- a/src/libstore/build/worker.cc
+++ b/src/libstore/build/worker.cc
@@ -94,7 +94,15 @@ std::pair<std::shared_ptr<G>, kj::Promise<Result<Goal::WorkResult>>> Worker::mak
}(goal, map, it);
};
cachedGoal.promise = kj::evalLater(std::move(removeWhenDone)).fork();
- childStarted(goal, cachedGoal.promise.addBranch());
+ children.add(cachedGoal.promise.addBranch().then([this](auto _result) {
+ if (_result.has_value()) {
+ auto & result = _result.value();
+ permanentFailure |= result.permanentFailure;
+ timedOut |= result.timedOut;
+ hashMismatch |= result.hashMismatch;
+ checkMismatch |= result.checkMismatch;
+ }
+ }));
} else {
if (!modify(*goal)) {
cachedGoal = {};
@@ -195,26 +203,6 @@ std::pair<GoalPtr, kj::Promise<Result<Goal::WorkResult>>> Worker::makeGoal(const
}, req.raw());
}
-
-void Worker::goalFinished(GoalPtr goal, Goal::WorkResult & f)
-{
- permanentFailure |= f.permanentFailure;
- timedOut |= f.timedOut;
- hashMismatch |= f.hashMismatch;
- checkMismatch |= f.checkMismatch;
-}
-
-void Worker::childStarted(GoalPtr goal, kj::Promise<Result<Goal::WorkResult>> promise)
-{
- children.add(promise
- .then([this, goal](auto result) {
- if (result.has_value()) {
- goalFinished(goal, result.assume_value());
- }
- }));
-}
-
-
kj::Promise<Result<Worker::Results>> Worker::updateStatistics()
try {
while (true) {
diff --git a/src/libstore/build/worker.hh b/src/libstore/build/worker.hh
index fcf0ad8c7..1a913ca16 100644
--- a/src/libstore/build/worker.hh
+++ b/src/libstore/build/worker.hh
@@ -132,13 +132,6 @@ private:
*/
bool checkMismatch = false;
- void goalFinished(GoalPtr goal, Goal::WorkResult & f);
-
- /**
- * Registers a running child process.
- */
- void childStarted(GoalPtr goal, kj::Promise<Result<Goal::WorkResult>> promise);
-
/**
* Pass current stats counters to the logger for progress bar updates.
*/