fix stored_count metric

This commit is contained in:
Sema Checherinda 2024-04-03 15:33:35 +02:00
parent 8e6cbc8b31
commit 922a14eaf1

View File

@ -560,6 +560,11 @@ public:
size_t wipeExpiredImpl(std::vector<ConnectionPtr> & expired_connections) TSA_REQUIRES(mutex) size_t wipeExpiredImpl(std::vector<ConnectionPtr> & expired_connections) TSA_REQUIRES(mutex)
{ {
SCOPE_EXIT({
CurrentMetrics::sub(getMetrics().stored_count, expired_connections.size());
ProfileEvents::increment(getMetrics().expired, expired_connections.size());
});
auto isSoftLimitReached = group->isSoftLimitReached(); auto isSoftLimitReached = group->isSoftLimitReached();
while (!stored_connections.empty()) while (!stored_connections.empty())
{ {
@ -573,9 +578,6 @@ public:
expired_connections.push_back(connection); expired_connections.push_back(connection);
} }
CurrentMetrics::sub(getMetrics().stored_count, expired_connections.size());
ProfileEvents::increment(getMetrics().expired, expired_connections.size());
return stored_connections.size(); return stored_connections.size();
} }