diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2017-03-16 13:50:01 +0100 |
---|---|---|
committer | Eelco Dolstra <edolstra@gmail.com> | 2017-03-16 13:50:01 +0100 |
commit | c5b83d8913d73ea58ff9437c41bf6bd0c6839ad0 (patch) | |
tree | a7b934a170322b26d8039461102a66de922308e2 /src/build-remote | |
parent | 91d67692cfb05e4ece744fb9d144921ae920f2de (diff) |
copyPaths(): Use queryValidPaths() to reduce SSH latency
Diffstat (limited to 'src/build-remote')
-rw-r--r-- | src/build-remote/build-remote.cc | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/build-remote/build-remote.cc b/src/build-remote/build-remote.cc index 3908dfac4..6b142db98 100644 --- a/src/build-remote/build-remote.cc +++ b/src/build-remote/build-remote.cc @@ -252,10 +252,10 @@ connected: string line; if (!getline(cin, line)) throw Error("hook caller didn't send inputs"); - auto inputs = tokenizeString<std::list<string>>(line); + auto inputs = tokenizeString<PathSet>(line); if (!getline(cin, line)) throw Error("hook caller didn't send outputs"); - auto outputs = tokenizeString<Strings>(line); + auto outputs = tokenizeString<PathSet>(line); AutoCloseFD uploadLock = openLockFile(currentLoad + "/" + hostName + ".upload-lock", true); auto old = signal(SIGALRM, handleAlarm); alarm(15 * 60); @@ -269,11 +269,15 @@ connected: printError("building ā%sā on ā%sā", drvPath, hostName); sshStore->buildDerivation(drvPath, readDerivation(drvPath)); - std::remove_if(outputs.begin(), outputs.end(), [=](const Path & path) { return store->isValidPath(path); }); - if (!outputs.empty()) { - setenv("NIX_HELD_LOCKS", concatStringsSep(" ", outputs).c_str(), 1); /* FIXME: ugly */ - copyPaths(ref<Store>(sshStore), store, outputs); + PathSet missing; + for (auto & path : outputs) + if (!store->isValidPath(path)) missing.insert(path); + + if (!missing.empty()) { + setenv("NIX_HELD_LOCKS", concatStringsSep(" ", missing).c_str(), 1); /* FIXME: ugly */ + copyPaths(ref<Store>(sshStore), store, missing); } + return; }); } |