1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-07-04 11:21:47 +02:00

introduces Goal::jobCategory

This commit is contained in:
Matej Urbas 2023-05-08 19:45:46 +01:00
parent 1ea1e378de
commit 13185133bc
5 changed files with 23 additions and 4 deletions

View file

@ -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 */