diff options
author | Puck Meerburg <puck@puckipedia.com> | 2024-04-27 17:15:51 +0000 |
---|---|---|
committer | Puck Meerburg <puck@puckipedia.com> | 2024-04-27 18:03:15 +0000 |
commit | 9229e87347271f41f84f87e80d47d9161231cdc1 (patch) | |
tree | ecf1101b924db7ada457ec7872b50833f444f13d /src/libstore | |
parent | 9462c01c3ea4c45927ba26a6918ad1daa65e32aa (diff) |
Fix progress bar on copyPaths
This variable should not be shared between activities.
Change-Id: I4eee89bc7acb320a3972dc3a55bfb087d3a9eb3a
Diffstat (limited to 'src/libstore')
-rw-r--r-- | src/libstore/store-api.cc | 9 |
1 files changed, 2 insertions, 7 deletions
diff --git a/src/libstore/store-api.cc b/src/libstore/store-api.cc index 69e89263b..8c9940c86 100644 --- a/src/libstore/store-api.cc +++ b/src/libstore/store-api.cc @@ -1085,8 +1085,6 @@ void copyStorePath( auto info = srcStore.queryPathInfo(storePath); - uint64_t total = 0; - // recompute store path on the chance dstStore does it differently if (info->ca && info->references.empty()) { auto info2 = make_ref<ValidPathInfo>(*info); @@ -1105,7 +1103,7 @@ void copyStorePath( } auto source = sinkToSource([&](Sink & sink) { - LambdaSink progressSink([&](std::string_view data) { + LambdaSink progressSink([&, total = 0ULL](std::string_view data) mutable { total += data.size(); act.progress(total, info->narSize); }); @@ -1218,9 +1216,6 @@ std::map<StorePath, StorePath> copyPaths( return storePathForDst; }; - // total is accessed by each copy, which are each handled in separate threads - std::atomic<uint64_t> total = 0; - for (auto & missingPath : sortedMissing) { auto info = srcStore.queryPathInfo(missingPath); @@ -1241,7 +1236,7 @@ std::map<StorePath, StorePath> copyPaths( {storePathS, srcUri, dstUri}); PushActivity pact(act.id); - LambdaSink progressSink([&](std::string_view data) { + LambdaSink progressSink([&, total = 0ULL](std::string_view data) mutable { total += data.size(); act.progress(total, info->narSize); }); |