diff options
author | Matej Urbas <matej.urbas@gmail.com> | 2023-05-08 19:45:46 +0100 |
---|---|---|
committer | Matej Urbas <matej.urbas@gmail.com> | 2023-05-08 19:45:46 +0100 |
commit | 13185133bcdff751274e55bf29b80b4e600cd973 (patch) | |
tree | 878720d15ad41970c720d27d6bbdada6ab78a2fd /src/libstore/build/worker.cc | |
parent | 1ea1e378de22bf32b5ccc1edf66798ab91299ac7 (diff) |
introduces `Goal::jobCategory`
Diffstat (limited to 'src/libstore/build/worker.cc')
-rw-r--r-- | src/libstore/build/worker.cc | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libstore/build/worker.cc b/src/libstore/build/worker.cc index 85024e4c4..ee334d54a 100644 --- a/src/libstore/build/worker.cc +++ b/src/libstore/build/worker.cc @@ -195,7 +195,7 @@ void Worker::childStarted(GoalPtr goal, const std::set<int> & fds, child.respectTimeouts = respectTimeouts; children.emplace_back(child); if (inBuildSlot) { - if (dynamic_cast<PathSubstitutionGoal *>(child.goal2)) nrSubstitutions++; + if (goal->jobCategory() == JobCategory::Substitution) nrSubstitutions++; else nrLocalBuilds++; } } @@ -208,7 +208,7 @@ void Worker::childTerminated(Goal * goal, bool wakeSleepers) if (i == children.end()) return; if (i->inBuildSlot) { - if (dynamic_cast<PathSubstitutionGoal *>(goal)) { + if (goal->jobCategory() == JobCategory::Substitution) { assert(nrSubstitutions > 0); nrSubstitutions--; } else { @@ -235,7 +235,7 @@ void Worker::childTerminated(Goal * goal, bool wakeSleepers) void Worker::waitForBuildSlot(GoalPtr goal) { debug("wait for build slot"); - bool isSubstitutionGoal = dynamic_cast<PathSubstitutionGoal *>(goal.get()); + bool isSubstitutionGoal = goal->jobCategory() == JobCategory::Substitution; if ((!isSubstitutionGoal && getNrLocalBuilds() < settings.maxBuildJobs) || (isSubstitutionGoal && getNrSubstitutions() < settings.maxSubstitutionJobs)) wakeUp(goal); /* we can do it right away */ |