fixup: Compute fingerprint only if needed

This commit is contained in:
Guillaume Maudoux 2024-04-25 00:47:46 +02:00 committed by GitHub
parent 1c4e392c64
commit 19cc50dcbf
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -464,10 +464,10 @@ ref<eval_cache::EvalCache> openEvalCache(
return aOutputs->value;
};
if (hash) {
auto search = state.evalCaches.find(hash.value());
if (fingerprint) {
auto search = state.evalCaches.find(fingerprint.value());
if (search == state.evalCaches.end()) {
search = state.evalCaches.emplace(hash.value(), make_ref<nix::eval_cache::EvalCache>(hash, state, rootLoader)).first;
search = state.evalCaches.emplace(fingerprint.value(), make_ref<nix::eval_cache::EvalCache>(fingerprint, state, rootLoader)).first;
}
return search->second;
} else {