From 9ac1a7988216f1252a600f6f67b685b9cc01283a Mon Sep 17 00:00:00 2001 From: Linus Heckemann Date: Tue, 24 Jul 2018 17:03:54 +0200 Subject: [PATCH] copyPathsToStore: honour keep-going --- src/libstore/store-api.cc | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 9b0b7d632..185435382 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -629,11 +629,12 @@ void copyPaths(ref srcStore, ref dstStore, const PathSet & storePa Activity act(*logger, lvlInfo, actCopyPaths, fmt("copying %d paths", missing.size())); std::atomic nrDone{0}; + std::atomic nrFailed{0}; std::atomic bytesExpected{0}; std::atomic nrRunning{0}; auto showProgress = [&]() { - act.progress(nrDone, missing.size(), nrRunning); + act.progress(nrDone, missing.size(), nrRunning, nrFailed); }; ThreadPool pool; @@ -662,7 +663,16 @@ void copyPaths(ref srcStore, ref dstStore, const PathSet & storePa if (!dstStore->isValidPath(storePath)) { MaintainCount mc(nrRunning); showProgress(); - copyStorePath(srcStore, dstStore, storePath, repair, checkSigs); + try { + copyStorePath(srcStore, dstStore, storePath, repair, checkSigs); + } catch (Error &e) { + nrFailed++; + if (!settings.keepGoing) + throw e; + logger->log(lvlError, format("could not copy %s: %s") % storePath % e.what()); + showProgress(); + return; + } } nrDone++;