aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/build.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-08-31 16:02:36 +0200
committerEelco Dolstra <edolstra@gmail.com>2017-08-31 16:05:07 +0200
commitbbdf08bc0facb5157a10c794712dae7e5902be03 (patch)
tree562c3e23d2179bc10881567f20fc28979a141ded /src/libstore/build.cc
parentfd73c1e20a7aaefcb69db3e6b2f081e1a5e20406 (diff)
Call queryMissing() prior to building
Without this, substitute info is fetched sequentially, which is superslow. In the old UI (e.g. nix-build), we call printMissing(), which calls queryMissing(), thereby preheating the binary cache cache. But the new UI doesn't do that.
Diffstat (limited to 'src/libstore/build.cc')
-rw-r--r--src/libstore/build.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 39f6128aa..ce41752e6 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -4166,10 +4166,20 @@ void Worker::markContentsGood(const Path & path)
//////////////////////////////////////////////////////////////////////
+static void primeCache(Store & store, const PathSet & paths)
+{
+ PathSet willBuild, willSubstitute, unknown;
+ unsigned long long downloadSize, narSize;
+ store.queryMissing(paths, willBuild, willSubstitute, unknown, downloadSize, narSize);
+}
+
+
void LocalStore::buildPaths(const PathSet & drvPaths, BuildMode buildMode)
{
Worker worker(*this);
+ primeCache(*this, drvPaths);
+
Goals goals;
for (auto & i : drvPaths) {
DrvPathWithOutputs i2 = parseDrvPathWithOutputs(i);
@@ -4220,6 +4230,8 @@ void LocalStore::ensurePath(const Path & path)
/* If the path is already valid, we're done. */
if (isValidPath(path)) return;
+ primeCache(*this, {path});
+
Worker worker(*this);
GoalPtr goal = worker.makeSubstitutionGoal(path);
Goals goals = {goal};