Remove bad daemon connections from the pool

This is necessary for long-running processes like hydra-queue-runner:
if a nix-daemon worker is killed, we need to stop reusing that
connection.
This commit is contained in:
Eelco Dolstra 2016-02-24 11:39:56 +01:00
parent d5626bf4c1
commit 5f862658c3
4 changed files with 55 additions and 14 deletions

View file

@ -40,7 +40,11 @@ template PathSet readStorePaths(Source & from);
RemoteStore::RemoteStore(size_t maxConnections)
: connections(make_ref<Pool<Connection>>(maxConnections, [this]() { return openConnection(); }))
: connections(make_ref<Pool<Connection>>(
maxConnections,
[this]() { return openConnection(); },
[](const ref<Connection> & r) { return r->to.good() && r->from.good(); }
))
{
}