1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-16 15:32:43 +01:00

BasicClientConnection::queryPathInfo(): Don't throw exception for invalid paths

This caused RemoteStore::queryPathInfoUncached() to mark the
connection as invalid (see
RemoteStore::ConnectionHandle::~ConnectionHandle()), causing it to
disconnect and reconnect after every lookup of an invalid path. This
caused huge slowdowns in conjunction with
19f89eb684 and lazy-trees.
This commit is contained in:
Eelco Dolstra 2025-08-10 17:48:19 +02:00
parent 48b600d995
commit c82b67fa05
3 changed files with 12 additions and 10 deletions

View file

@ -259,13 +259,14 @@ void RemoteStore::queryPathInfoUncached(
const StorePath & path, Callback<std::shared_ptr<const ValidPathInfo>> callback) noexcept
{
try {
std::shared_ptr<const ValidPathInfo> info;
{
auto info = ({
auto conn(getConnection());
info = std::make_shared<ValidPathInfo>(
StorePath{path}, conn->queryPathInfo(*this, &conn.daemonException, path));
}
callback(std::move(info));
conn->queryPathInfo(*this, &conn.daemonException, path);
});
if (!info)
callback(nullptr);
else
callback(std::make_shared<ValidPathInfo>(StorePath{path}, *info));
} catch (...) {
callback.rethrow();
}