aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/build/worker.cc
diff options
context:
space:
mode:
authoreldritch horrors <pennae@lix.systems>2024-03-04 05:58:02 +0100
committereldritch horrors <pennae@lix.systems>2024-03-04 05:58:02 +0100
commit01069d8c467f181e1a13f10486a25473a1a0b386 (patch)
tree5802e870febe24ea169b962517885e16f121f326 /src/libstore/build/worker.cc
parent439f88b7d7596ccd4d1130b5c3e65f6e2ad9658a (diff)
Merge pull request #9400 from hercules-ci/refactors-from-5e3986f59cb
Refactors from 5e3986f59cb (cherry picked from commit e540d48c4fb460e5e577d8b8b33e8eca9959c49b) Change-Id: I5b21b770a0c20ec2ec9845d3a97a524f1b0135ee
Diffstat (limited to 'src/libstore/build/worker.cc')
-rw-r--r--src/libstore/build/worker.cc21
1 files changed, 17 insertions, 4 deletions
diff --git a/src/libstore/build/worker.cc b/src/libstore/build/worker.cc
index 37cb86b91..99004fba5 100644
--- a/src/libstore/build/worker.cc
+++ b/src/libstore/build/worker.cc
@@ -198,8 +198,16 @@ void Worker::childStarted(GoalPtr goal, const std::set<int> & fds,
child.respectTimeouts = respectTimeouts;
children.emplace_back(child);
if (inBuildSlot) {
- if (goal->jobCategory() == JobCategory::Substitution) nrSubstitutions++;
- else nrLocalBuilds++;
+ switch (goal->jobCategory()) {
+ case JobCategory::Substitution:
+ nrSubstitutions++;
+ break;
+ case JobCategory::Build:
+ nrLocalBuilds++;
+ break;
+ default:
+ abort();
+ }
}
}
@@ -211,12 +219,17 @@ void Worker::childTerminated(Goal * goal, bool wakeSleepers)
if (i == children.end()) return;
if (i->inBuildSlot) {
- if (goal->jobCategory() == JobCategory::Substitution) {
+ switch (goal->jobCategory()) {
+ case JobCategory::Substitution:
assert(nrSubstitutions > 0);
nrSubstitutions--;
- } else {
+ break;
+ case JobCategory::Build:
assert(nrLocalBuilds > 0);
nrLocalBuilds--;
+ break;
+ default:
+ abort();
}
}