diff --git a/src/libstore/build/worker.cc b/src/libstore/build/worker.cc index 27d8e6ee1..2cc2828b1 100644 --- a/src/libstore/build/worker.cc +++ b/src/libstore/build/worker.cc @@ -438,38 +438,17 @@ void Worker::waitForInput() { printMsg(lvlVomit, "waiting for children"); - auto childFinished = [&]{ + auto waitFor = [&]{ auto pair = kj::newPromiseAndFulfiller(); this->childFinished = kj::mv(pair.fulfiller); return kj::mv(pair.promise); }(); - /* Process output from the file descriptors attached to the - children, namely log output and output path creation commands. - We also use this to detect child termination: if we get EOF on - the logger pipe of a build, we assume that the builder has - terminated. */ - - std::optional timeout = 0; - - // Periodicallty wake up to see if we need to run the garbage collector. if (settings.minFree.get() != 0) { - timeout = 10; + // Periodicallty wake up to see if we need to run the garbage collector. + waitFor = waitFor.exclusiveJoin(aio.provider->getTimer().afterDelay(10 * kj::SECONDS)); } - if (timeout) - vomit("sleeping %d seconds", *timeout); - - auto waitFor = [&] { - if (timeout) { - return aio.provider->getTimer() - .afterDelay(*timeout * kj::SECONDS) - .exclusiveJoin(kj::mv(childFinished)); - } else { - return std::move(childFinished); - } - }(); - waitFor.wait(aio.waitScope); }