about summary refs log tree commit diff
path: root/src/libstore/remote-store.hh
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-09-14T16·10+0200
committerEelco Dolstra <edolstra@gmail.com>2017-09-14T16·10+0200
commit89dc62c1745950748084a763ea325bc427045e07 (patch)
treeb31517cd86f5da52cb34ce788d4b219a49fc35d7 /src/libstore/remote-store.hh
parent308ecf63611c858327f163a154a3216fd6195ed9 (diff)
RemoteStore: Add option to drop old connections from the pool
This is a hack to make hydra-queue-runner free its temproots
periodically, thereby ensuring that garbage collection of the
corresponding paths is not blocked until the queue runner is
restarted.

It would be better if temproots could be released earlier than at
process exit. I started working on a RAII object returned by functions
like addToStore() that releases temproots. However, this would be a
pretty massive change so I gave up on it for now.
Diffstat (limited to 'src/libstore/remote-store.hh')
-rw-r--r--src/libstore/remote-store.hh6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/libstore/remote-store.hh b/src/libstore/remote-store.hh
index e370e4797d..30c6beae6f 100644
--- a/src/libstore/remote-store.hh
+++ b/src/libstore/remote-store.hh
@@ -25,6 +25,9 @@ public:
     const Setting<int> maxConnections{(Store*) this, 1,
             "max-connections", "maximum number of concurrent connections to the Nix daemon"};
 
+    const Setting<unsigned int> maxConnectionAge{(Store*) this, std::numeric_limits<unsigned int>::max(),
+            "max-connection-age", "number of seconds to reuse a connection"};
+
     RemoteStore(const Params & params);
 
     /* Implementations of abstract store API methods. */
@@ -95,6 +98,8 @@ public:
 
     void connect() override;
 
+    void flushBadConnections();
+
 protected:
 
     struct Connection
@@ -102,6 +107,7 @@ protected:
         FdSink to;
         FdSource from;
         unsigned int daemonVersion;
+        std::chrono::time_point<std::chrono::steady_clock> startTime;
 
         virtual ~Connection();