From ed9b7f4f84fd60ad8618645cc1bae2d686ff0db6 Mon Sep 17 00:00:00 2001 From: eldritch horrors Date: Sat, 5 Oct 2024 00:38:35 +0200 Subject: 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 --- src/libstore/build/worker.cc | 30 +++++++++--------------------- src/libstore/build/worker.hh | 7 ------- 2 files changed, 9 insertions(+), 28 deletions(-) (limited to 'src') 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, kj::Promise>> 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>> 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> promise) -{ - children.add(promise - .then([this, goal](auto result) { - if (result.has_value()) { - goalFinished(goal, result.assume_value()); - } - })); -} - - kj::Promise> 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> promise); - /** * Pass current stats counters to the logger for progress bar updates. */ -- cgit v1.2.3