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:
parent
48b600d995
commit
c82b67fa05
3 changed files with 12 additions and 10 deletions
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue