diff options
author | eldritch horrors <pennae@lix.systems> | 2024-03-21 21:33:14 +0100 |
---|---|---|
committer | eldritch horrors <pennae@lix.systems> | 2024-03-31 00:07:09 +0000 |
commit | 862f20a4ba4a917e3442db2963e7f75bd7f567bf (patch) | |
tree | 4d9a876a002f0360dbc89da48b1801fe0eb69bfc | |
parent | 620de98d0ce8d6a9207a6a54c7fc66cfa55f7797 (diff) |
libutil: remove Pool::flushBad
this was never actually used, and bad design in the first place—why
should a bad resource be put back into the idle pool? just drop it.
Change-Id: Idab8774bee19dadae0209d404c4fb86dd4aeba1e
-rw-r--r-- | src/libstore/remote-store.cc | 5 | ||||
-rw-r--r-- | src/libstore/remote-store.hh | 2 | ||||
-rw-r--r-- | src/libutil/pool.hh | 10 | ||||
-rw-r--r-- | tests/unit/libutil/pool.cc | 15 |
4 files changed, 0 insertions, 32 deletions
diff --git a/src/libstore/remote-store.cc b/src/libstore/remote-store.cc index f0dbe8e21..20c1c50f2 100644 --- a/src/libstore/remote-store.cc +++ b/src/libstore/remote-store.cc @@ -940,11 +940,6 @@ std::optional<TrustedFlag> RemoteStore::isTrustedClient() return conn->remoteTrustsUs; } -void RemoteStore::flushBadConnections() -{ - connections->flushBad(); -} - RemoteStore::Connection::~Connection() { diff --git a/src/libstore/remote-store.hh b/src/libstore/remote-store.hh index f0985fdc1..0cae81e16 100644 --- a/src/libstore/remote-store.hh +++ b/src/libstore/remote-store.hh @@ -161,8 +161,6 @@ public: std::optional<TrustedFlag> isTrustedClient() override; - void flushBadConnections(); - struct Connection; ref<Connection> openConnectionWrapper(); diff --git a/src/libutil/pool.hh b/src/libutil/pool.hh index 548e7ce69..b7a749e3a 100644 --- a/src/libutil/pool.hh +++ b/src/libutil/pool.hh @@ -184,16 +184,6 @@ 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); - } }; } diff --git a/tests/unit/libutil/pool.cc b/tests/unit/libutil/pool.cc index a3743e601..3ad4ed3aa 100644 --- a/tests/unit/libutil/pool.cc +++ b/tests/unit/libutil/pool.cc @@ -65,21 +65,6 @@ namespace nix { ASSERT_EQ(pool.capacity(), 0); } - TEST(Pool, flushBadDropsOutOfScopeResources) { - auto isGood = [](const ref<TestResource> & r) { return false; }; - auto createResource = []() { return make_ref<TestResource>(); }; - - Pool<TestResource> pool = Pool<TestResource>((size_t)1, createResource, isGood); - - { - auto _r = pool.get(); - ASSERT_EQ(pool.count(), 1); - } - - pool.flushBad(); - ASSERT_EQ(pool.count(), 0); - } - // Test that the resources we allocate are being reused when they are still good. TEST(Pool, reuseResource) { auto isGood = [](const ref<TestResource> & r) { return true; }; |