diff options
author | Eelco Dolstra <edolstra@gmail.com> | 2021-11-16 12:54:20 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-16 12:54:20 +0100 |
commit | 6463eaca14ea813f39a3b3e4c5a15fa32fc30232 (patch) | |
tree | eda8501ca6ca1adffb702a78ca265339490665c0 /src/libstore/local-store.cc | |
parent | 6d0aa8d17544e391872eed76f4c627e4c1f9c05b (diff) | |
parent | f4c869977c391b31eb4f20486f7da03b026e2401 (diff) |
Merge pull request #5472 from NixOS/async-realisation-substitution
async realisation substitution
Diffstat (limited to 'src/libstore/local-store.cc')
-rw-r--r-- | src/libstore/local-store.cc | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index eecd407f5..64019314f 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -1836,13 +1836,24 @@ std::optional<const Realisation> LocalStore::queryRealisation_( return { res }; } -std::optional<const Realisation> -LocalStore::queryRealisation(const DrvOutput & id) +void LocalStore::queryRealisationUncached(const DrvOutput & id, + Callback<std::shared_ptr<const Realisation>> callback) noexcept { - return retrySQLite<std::optional<const Realisation>>([&]() { - auto state(_state.lock()); - return queryRealisation_(*state, id); - }); + try { + auto maybeRealisation + = retrySQLite<std::optional<const Realisation>>([&]() { + auto state(_state.lock()); + return queryRealisation_(*state, id); + }); + if (maybeRealisation) + callback( + std::make_shared<const Realisation>(maybeRealisation.value())); + else + callback(nullptr); + + } catch (...) { + callback.rethrow(); + } } FixedOutputHash LocalStore::hashCAPath( |