From 19c079bff86325d54749f870385922c76c6c8040 Mon Sep 17 00:00:00 2001 From: filipecosta90 Date: Mon, 6 Feb 2023 15:38:14 +0000 Subject: [PATCH] ensuring that when there are multiple shards the keys pool is bellow request count(when defined) --- cluster_client.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/cluster_client.cpp b/cluster_client.cpp index 215feac9..e8b72ac2 100644 --- a/cluster_client.cpp +++ b/cluster_client.cpp @@ -346,8 +346,10 @@ bool cluster_client::get_key_for_conn(unsigned int conn_id, int iter, unsigned l continue; // store key for other connection, if queue is not full + // and the total number of requests is larger than m_key_index_pools.size() * KEY_INDEX_QUEUE_MAX_SIZE key_index_pool* key_idx_pool = m_key_index_pools[other_conn_id]; - if (key_idx_pool->size() < KEY_INDEX_QUEUE_MAX_SIZE) { + if (key_idx_pool->size() < KEY_INDEX_QUEUE_MAX_SIZE && + (m_config->requests == 0 || (m_key_index_pools.size() * KEY_INDEX_QUEUE_MAX_SIZE) < m_config->requests)) { key_idx_pool->push(*key_index); m_reqs_generated++; }