Skip to content

Commit

Permalink
copyPathsToStore: honour keep-going
Browse files Browse the repository at this point in the history
  • Loading branch information
lheckemann committed Jul 24, 2018
1 parent a7fb7d3 commit 9ac1a79
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/libstore/store-api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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++;
Expand Down

0 comments on commit 9ac1a79

Please sign in to comment.