mirror of
https://github.com/NixOS/nix.git
synced 2025-11-09 12:06:01 +01:00
Get rid of a tryToBuild tail recursive call with loop
This will make it easier to convert somethings to RAII.
This commit is contained in:
parent
95c5779880
commit
4c44a213a3
1 changed files with 90 additions and 86 deletions
|
|
@ -472,6 +472,7 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
|
|||
{
|
||||
bool useHook;
|
||||
|
||||
while (true) {
|
||||
trace("trying to build");
|
||||
|
||||
/* Obtain locks on all output paths, if the paths are known a priori.
|
||||
|
|
@ -500,7 +501,8 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
|
|||
}
|
||||
|
||||
if (!outputLocks.lockPaths(lockFiles, "", false)) {
|
||||
Activity act(*logger, lvlWarn, actBuildWaiting, fmt("waiting for lock on %s", Magenta(showPaths(lockFiles))));
|
||||
Activity act(
|
||||
*logger, lvlWarn, actBuildWaiting, fmt("waiting for lock on %s", Magenta(showPaths(lockFiles))));
|
||||
|
||||
/* Wait then try locking again, repeat until success (returned
|
||||
boolean is true). */
|
||||
|
|
@ -538,8 +540,8 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
|
|||
/* Don't do a remote build if the derivation has the attribute
|
||||
`preferLocalBuild' set. Also, check and repair modes are only
|
||||
supported for local builds. */
|
||||
bool buildLocally =
|
||||
(buildMode != bmNormal || drvOptions->willBuildLocally(worker.store, *drv)) && settings.maxBuildJobs.get() != 0;
|
||||
bool buildLocally = (buildMode != bmNormal || drvOptions->willBuildLocally(worker.store, *drv))
|
||||
&& settings.maxBuildJobs.get() != 0;
|
||||
|
||||
if (buildLocally) {
|
||||
useHook = false;
|
||||
|
|
@ -561,13 +563,15 @@ Goal::Co DerivationBuildingGoal::tryToBuild()
|
|||
fmt("waiting for a machine to build '%s'", Magenta(worker.store.printStorePath(drvPath))));
|
||||
outputLocks.unlock();
|
||||
co_await waitForAWhile();
|
||||
co_return tryToBuild();
|
||||
continue;
|
||||
case rpDecline:
|
||||
/* We should do it ourselves. */
|
||||
useHook = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
actLock.reset();
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue