Don't wait forever to acquire the send lock

This commit is contained in:
Eelco Dolstra 2017-09-01 15:29:06 +02:00
parent b405837d4d
commit 50ab80caf2
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
2 changed files with 3 additions and 2 deletions

View file

@ -229,7 +229,8 @@ void State::buildRemote(ref<Store> destStore,
/* Copy the input closure. */
if (/* machine->sshName != "localhost" */ true) {
auto mc1 = std::make_shared<MaintainCount>(nrStepsWaiting);
std::lock_guard<std::mutex> sendLock(machine->state->sendLock);
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);

View file

@ -231,7 +231,7 @@ struct Machine
/* Mutex to prevent multiple threads from sending data to the
same machine (which would be inefficient). */
std::mutex sendLock;
std::timed_mutex sendLock;
};
State::ptr state;