Remove TokenServer in preparation of making NAR copying O(1) memory
This commit is contained in:
@ -426,31 +426,11 @@ void State::buildRemote(ref<Store> destStore,
|
||||
printMsg(lvlDebug, "copying outputs of ‘%s’ from ‘%s’ (%d bytes)",
|
||||
localStore->printStorePath(step->drvPath), machine->sshName, totalNarSize);
|
||||
|
||||
/* Block until we have the required amount of memory
|
||||
available, which is twice the NAR size (namely the
|
||||
uncompressed and worst-case compressed NAR), plus 150
|
||||
MB for xz compression overhead. (The xz manpage claims
|
||||
~94 MiB, but that's not was I'm seeing.) */
|
||||
auto resStart = std::chrono::steady_clock::now();
|
||||
size_t compressionCost = totalNarSize + 150 * 1024 * 1024;
|
||||
result.tokens = std::make_unique<nix::TokenServer::Token>(memoryTokens.get(totalNarSize + compressionCost));
|
||||
auto resStop = std::chrono::steady_clock::now();
|
||||
|
||||
auto resMs = std::chrono::duration_cast<std::chrono::milliseconds>(resStop - resStart).count();
|
||||
if (resMs >= 1000)
|
||||
printMsg(lvlError, "warning: had to wait %d ms for %d memory tokens for %s",
|
||||
resMs, totalNarSize, localStore->printStorePath(step->drvPath));
|
||||
|
||||
to << cmdExportPaths << 0;
|
||||
writeStorePaths(*localStore, to, outputs);
|
||||
to.flush();
|
||||
destStore->importPaths(from, /* result.accessor, */ NoCheckSigs);
|
||||
|
||||
/* Release the tokens pertaining to NAR
|
||||
compression. After this we only have the uncompressed
|
||||
NAR in memory. */
|
||||
result.tokens->give_back(compressionCost);
|
||||
|
||||
auto now2 = std::chrono::steady_clock::now();
|
||||
|
||||
result.overhead += std::chrono::duration_cast<std::chrono::milliseconds>(now2 - now1).count();
|
||||
|
Reference in New Issue
Block a user