Acquire the send lock only while actually sending
Thus, we no longer hold the send lock while substituting missing paths on the build machine. This is a good thing in particular for macOS builders which have a tendency to hang forever in curl downloads.
This commit is contained in:
parent
50ab80caf2
commit
4af97c57f5
|
@ -77,7 +77,7 @@ static void openConnection(Machine::ptr machine, Path tmpDir, int stderrFD, Chil
|
|||
}
|
||||
|
||||
|
||||
static void copyClosureTo(ref<Store> destStore,
|
||||
static void copyClosureTo(std::timed_mutex & sendMutex, ref<Store> destStore,
|
||||
FdSource & from, FdSink & to, const PathSet & paths,
|
||||
bool useSubstitutes = false)
|
||||
{
|
||||
|
@ -107,6 +107,9 @@ static void copyClosureTo(ref<Store> destStore,
|
|||
|
||||
printMsg(lvlDebug, format("sending %1% missing paths") % missing.size());
|
||||
|
||||
std::unique_lock<std::timed_mutex> sendLock(sendMutex,
|
||||
std::chrono::seconds(600));
|
||||
|
||||
to << cmdImportPaths;
|
||||
destStore->exportPaths(missing, to);
|
||||
to.flush();
|
||||
|
@ -229,15 +232,13 @@ void State::buildRemote(ref<Store> destStore,
|
|||
/* Copy the input closure. */
|
||||
if (/* machine->sshName != "localhost" */ true) {
|
||||
auto mc1 = std::make_shared<MaintainCount>(nrStepsWaiting);
|
||||
std::unique_lock<std::timed_mutex> sendLock(
|
||||
machine->state->sendLock, std::chrono::seconds(600));
|
||||
mc1.reset();
|
||||
MaintainCount mc2(nrStepsCopyingTo);
|
||||
printMsg(lvlDebug, format("sending closure of ‘%1%’ to ‘%2%’") % step->drvPath % machine->sshName);
|
||||
|
||||
auto now1 = std::chrono::steady_clock::now();
|
||||
|
||||
copyClosureTo(destStore, from, to, inputs, true);
|
||||
copyClosureTo(machine->state->sendLock, destStore, from, to, inputs, true);
|
||||
|
||||
auto now2 = std::chrono::steady_clock::now();
|
||||
|
||||
|
|
Loading…
Reference in a new issue