1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-25 19:01:16 +02:00

Merge pull request #12203 from NixOS/mergify/bp/2.24-maintenance/pr-11424

Pull fut.get() out of the lock (backport #11424)
This commit is contained in:
mergify[bot] 2025-01-10 22:12:00 +00:00 committed by GitHub
commit 01cb05a265
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -822,14 +822,25 @@ StorePathSet Store::queryValidPaths(const StorePathSet & paths, SubstituteFlag m
auto doQuery = [&](const StorePath & path) {
checkInterrupt();
queryPathInfo(path, {[path, &state_, &wakeup](std::future<ref<const ValidPathInfo>> fut) {
auto state(state_.lock());
bool exists = false;
std::exception_ptr newExc{};
try {
auto info = fut.get();
state->valid.insert(path);
exists = true;
} catch (InvalidPath &) {
} catch (...) {
state->exc = std::current_exception();
newExc = std::current_exception();
}
auto state(state_.lock());
if (exists)
state->valid.insert(path);
if (newExc)
state->exc = newExc;
assert(state->left);
if (!--state->left)
wakeup.notify_one();