1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-27 04:21:16 +02:00

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.
This commit is contained in:
Eelco Dolstra 2017-09-14 18:10:38 +02:00
parent 308ecf6361
commit 89dc62c174
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE
3 changed files with 31 additions and 1 deletions

View file

@ -168,6 +168,16 @@ public:
{
return state.lock()->max;
}
void flushBad()
{
auto state_(state.lock());
std::vector<ref<R>> left;
for (auto & p : state_->idle)
if (validator(p))
left.push_back(p);
std::swap(state_->idle, left);
}
};
}