Skip to content

Commit bbdf08b

Browse files
committed
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.
1 parent fd73c1e commit bbdf08b

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

src/libstore/build.cc

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4166,10 +4166,20 @@ void Worker::markContentsGood(const Path & path)
41664166
//////////////////////////////////////////////////////////////////////
41674167

41684168

4169+
static void primeCache(Store & store, const PathSet & paths)
4170+
{
4171+
PathSet willBuild, willSubstitute, unknown;
4172+
unsigned long long downloadSize, narSize;
4173+
store.queryMissing(paths, willBuild, willSubstitute, unknown, downloadSize, narSize);
4174+
}
4175+
4176+
41694177
void LocalStore::buildPaths(const PathSet & drvPaths, BuildMode buildMode)
41704178
{
41714179
Worker worker(*this);
41724180

4181+
primeCache(*this, drvPaths);
4182+
41734183
Goals goals;
41744184
for (auto & i : drvPaths) {
41754185
DrvPathWithOutputs i2 = parseDrvPathWithOutputs(i);
@@ -4220,6 +4230,8 @@ void LocalStore::ensurePath(const Path & path)
42204230
/* If the path is already valid, we're done. */
42214231
if (isValidPath(path)) return;
42224232

4233+
primeCache(*this, {path});
4234+
42234235
Worker worker(*this);
42244236
GoalPtr goal = worker.makeSubstitutionGoal(path);
42254237
Goals goals = {goal};

src/libstore/misc.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ void Store::queryMissing(const PathSet & targets,
107107
PathSet & willBuild_, PathSet & willSubstitute_, PathSet & unknown_,
108108
unsigned long long & downloadSize_, unsigned long long & narSize_)
109109
{
110+
Activity act(*logger, lvlDebug, actUnknown, "querying info about missing paths");
111+
110112
downloadSize_ = narSize_ = 0;
111113

112114
ThreadPool pool;

0 commit comments

Comments
 (0)