From 89dc62c1745950748084a763ea325bc427045e07 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Thu, 14 Sep 2017 18:10:38 +0200 Subject: 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. --- src/libutil/pool.hh | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'src/libutil/pool.hh') diff --git a/src/libutil/pool.hh b/src/libutil/pool.hh index 703309002..0b142b059 100644 --- a/src/libutil/pool.hh +++ b/src/libutil/pool.hh @@ -168,6 +168,16 @@ public: { return state.lock()->max; } + + void flushBad() + { + auto state_(state.lock()); + std::vector> left; + for (auto & p : state_->idle) + if (validator(p)) + left.push_back(p); + std::swap(state_->idle, left); + } }; } -- cgit v1.2.3