aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlexander Bantyev <balsoft@balsoft.ru>2020-09-25 00:07:42 +0300
committerAlexander Bantyev <balsoft@balsoft.ru>2020-09-25 00:07:42 +0300
commited218e1d6cf755fc3011c0954eb7031f95d3d732 (patch)
tree9aac5110a955db9976c6f7dbac4b080a460f2586
parent8d9402f411643c451cf2a0776afcb3a1af0f9a8c (diff)
Fix max-jobs option
After 0ed946aa616bbf7ffe7f90d3309abdd27d875b10, max-jobs setting (-j/--max-jobs) stopped working. The reason was that nrLocalBuilds (which compared to maxBuildJobs to figure out whether the limit is reached or not) is not incremented yet when tryBuild is started; So, the solution is to move the check to tryLocalBuild. Closes https://github.com/nixos/nix/issues/3763
-rw-r--r--src/libstore/build.cc13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index db7dbc17e..3fc24b221 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -1612,6 +1612,13 @@ void DerivationGoal::tryToBuild()
actLock.reset();
+ state = &DerivationGoal::tryLocalBuild;
+ worker.wakeUp(shared_from_this());
+}
+
+void DerivationGoal::tryLocalBuild() {
+ bool buildLocally = buildMode != bmNormal || parsedDrv->willBuildLocally(worker.store);
+
/* Make sure that we are allowed to start a build. If this
derivation prefers to be done locally, do it even if
maxBuildJobs is 0. */
@@ -1622,12 +1629,6 @@ void DerivationGoal::tryToBuild()
return;
}
- state = &DerivationGoal::tryLocalBuild;
- worker.wakeUp(shared_from_this());
-}
-
-void DerivationGoal::tryLocalBuild() {
-
/* If `build-users-group' is not empty, then we have to build as
one of the members of that group. */
if (settings.buildUsersGroup != "" && getuid() == 0) {