diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index 7cd84d03d4a801646fe91989ee7a79fe5c7e73fc..41e1c37a0572aa5f63a822afe0da33da4713fb26 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -783,15 +783,11 @@ PathSet LocalStore::querySubstitutablePaths(const PathSet & paths) if (!settings.useSubstitutes) return PathSet(); PathSet res; for (auto & sub : getDefaultSubstituters()) { + if (res.size() == paths.size()) break; if (sub->storeDir != storeDir) continue; if (!sub->wantMassQuery()) continue; - for (auto & path : paths) { - if (res.count(path)) continue; - debug(format("checking substituter ‘%s’ for path ‘%s’") - % sub->getUri() % path); - if (sub->isValidPath(path)) - res.insert(path); - } + for (auto path : sub->queryValidPaths(paths)) + res.insert(path); } return res; }