1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2024-09-18 10:30:23 -04:00

Merge pull request #11402 from DeterminateSystems/fix-max-substitution-jobs

Respect max-substitution-jobs again
This commit is contained in:
Eelco Dolstra 2024-09-03 13:35:34 +02:00 committed by GitHub
commit 784a8436a0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 7 additions and 7 deletions

View file

@ -183,7 +183,7 @@ Goal::Co PathSubstitutionGoal::tryToRun(StorePath subPath, nix::ref<Store> sub,
/* Make sure that we are allowed to start a substitution. Note that even /* Make sure that we are allowed to start a substitution. Note that even
if maxSubstitutionJobs == 0, we still allow a substituter to run. This if maxSubstitutionJobs == 0, we still allow a substituter to run. This
prevents infinite waiting. */ prevents infinite waiting. */
if (worker.getNrSubstitutions() >= std::max(1U, (unsigned int) settings.maxSubstitutionJobs)) { while (worker.getNrSubstitutions() >= std::max(1U, (unsigned int) settings.maxSubstitutionJobs)) {
worker.waitForBuildSlot(shared_from_this()); worker.waitForBuildSlot(shared_from_this());
co_await Suspend{}; co_await Suspend{};
} }

View file

@ -184,13 +184,13 @@ void Worker::wakeUp(GoalPtr goal)
} }
unsigned Worker::getNrLocalBuilds() size_t Worker::getNrLocalBuilds()
{ {
return nrLocalBuilds; return nrLocalBuilds;
} }
unsigned Worker::getNrSubstitutions() size_t Worker::getNrSubstitutions()
{ {
return nrSubstitutions; return nrSubstitutions;
} }

View file

@ -92,12 +92,12 @@ private:
* Number of build slots occupied. This includes local builds but does not * Number of build slots occupied. This includes local builds but does not
* include substitutions or remote builds via the build hook. * include substitutions or remote builds via the build hook.
*/ */
unsigned int nrLocalBuilds; size_t nrLocalBuilds;
/** /**
* Number of substitution slots occupied. * Number of substitution slots occupied.
*/ */
unsigned int nrSubstitutions; size_t nrSubstitutions;
/** /**
* Maps used to prevent multiple instantiations of a goal for the * Maps used to prevent multiple instantiations of a goal for the
@ -235,12 +235,12 @@ public:
* Return the number of local build processes currently running (but not * Return the number of local build processes currently running (but not
* remote builds via the build hook). * remote builds via the build hook).
*/ */
unsigned int getNrLocalBuilds(); size_t getNrLocalBuilds();
/** /**
* Return the number of substitution processes currently running. * Return the number of substitution processes currently running.
*/ */
unsigned int getNrSubstitutions(); size_t getNrSubstitutions();
/** /**
* Registers a running child process. `inBuildSlot` means that * Registers a running child process. `inBuildSlot` means that