aboutsummaryrefslogtreecommitdiff
path: root/src/libstore
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2016-02-24 11:39:56 +0100
committerEelco Dolstra <eelco.dolstra@logicblox.com>2016-02-24 11:39:56 +0100
commit5f862658c3f8e518fb631d0536f2b38f107970e1 (patch)
tree34a38a2405fda244f547b06c6db264f3986e1aab /src/libstore
parentd5626bf4c14f725136f2c5b6ac8bf818627352f0 (diff)
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.
Diffstat (limited to 'src/libstore')
-rw-r--r--src/libstore/remote-store.cc6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc
index f6ec3fffb..2f540c640 100644
--- a/src/libstore/remote-store.cc
+++ b/src/libstore/remote-store.cc
@@ -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(); }
+ ))
{
}