aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2018-07-24 17:23:13 +0200
committerGitHub <noreply@github.com>2018-07-24 17:23:13 +0200
commitf602ff264beafd8f7bb5a17d63c7b9412c5fc6eb (patch)
tree278e393b27400ac35494833ce1329612c47b1dea
parenta7fb7d3cde48e6f54b59d539d906dda1d7107ffa (diff)
parent9ac1a7988216f1252a600f6f67b685b9cc01283a (diff)
Merge pull request #2305 from lheckemann/copy-keep-going
copyPathsToStore: honour keep-going
-rw-r--r--src/libstore/store-api.cc14
1 files 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<Store> srcStore, ref<Store> dstStore, const PathSet & storePa
Activity act(*logger, lvlInfo, actCopyPaths, fmt("copying %d paths", missing.size()));
std::atomic<size_t> nrDone{0};
+ std::atomic<size_t> nrFailed{0};
std::atomic<uint64_t> bytesExpected{0};
std::atomic<uint64_t> 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<Store> srcStore, ref<Store> dstStore, const PathSet & storePa
if (!dstStore->isValidPath(storePath)) {
MaintainCount<decltype(nrRunning)> 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++;