Merge "libstore: fix queryValidPaths concurrency" into main
This commit is contained in:
commit
6c29a2a6fc
1 changed files with 21 additions and 7 deletions
|
@ -803,17 +803,31 @@ StorePathSet Store::queryValidPaths(const StorePathSet & paths, SubstituteFlag m
|
||||||
|
|
||||||
auto doQuery = [&](const StorePath & path) {
|
auto doQuery = [&](const StorePath & path) {
|
||||||
checkInterrupt();
|
checkInterrupt();
|
||||||
auto state(state_.lock());
|
|
||||||
|
bool exists = false;
|
||||||
|
std::exception_ptr newExc{};
|
||||||
|
|
||||||
try {
|
try {
|
||||||
auto info = queryPathInfo(path);
|
queryPathInfo(path);
|
||||||
state->valid.insert(path);
|
exists = true;
|
||||||
} catch (InvalidPath &) {
|
} catch (InvalidPath &) {
|
||||||
} catch (...) {
|
} catch (...) {
|
||||||
state->exc = std::current_exception();
|
newExc = std::current_exception();
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
auto state(state_.lock());
|
||||||
|
|
||||||
|
if (exists) {
|
||||||
|
state->valid.insert(path);
|
||||||
|
}
|
||||||
|
if (newExc != nullptr) {
|
||||||
|
state->exc = newExc;
|
||||||
|
}
|
||||||
|
assert(state->left);
|
||||||
|
if (!--state->left)
|
||||||
|
wakeup.notify_one();
|
||||||
}
|
}
|
||||||
assert(state->left);
|
|
||||||
if (!--state->left)
|
|
||||||
wakeup.notify_one();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
for (auto & path : paths)
|
for (auto & path : paths)
|
||||||
|
|
Loading…
Reference in a new issue