From 2543a4a0a5ad185e64b44a2965b72e2c49d1f396 Mon Sep 17 00:00:00 2001 From: GilboaAWS Date: Wed, 25 Sep 2024 14:16:02 +0000 Subject: [PATCH] Added inflight_requests_limit Signed-off-by: GilboaAWS --- python/python/glide/config.py | 2 +- python/python/tests/conftest.py | 2 +- python/python/tests/test_async_client.py | 9 ++++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/python/python/glide/config.py b/python/python/glide/config.py index cf6c046f2e..db85202876 100644 --- a/python/python/glide/config.py +++ b/python/python/glide/config.py @@ -389,7 +389,7 @@ class GlideClusterClientConfiguration(BaseClientConfiguration): This limit is used to control the memory usage and prevent the client from overwhelming the server or getting stuck in case of a queue backlog. If not set, a default value will be used. - + Notes: Currently, the reconnection strategy in cluster mode is not configurable, and exponential backoff diff --git a/python/python/tests/conftest.py b/python/python/tests/conftest.py index c575e9285e..65ef1eb540 100644 --- a/python/python/tests/conftest.py +++ b/python/python/tests/conftest.py @@ -246,7 +246,7 @@ async def create_client( protocol=protocol, request_timeout=timeout, pubsub_subscriptions=cluster_mode_pubsub, - inflight_requests_limit=inflight_requests_limit + inflight_requests_limit=inflight_requests_limit, ) return await GlideClusterClient.create(cluster_config) else: diff --git a/python/python/tests/test_async_client.py b/python/python/tests/test_async_client.py index 5fcb031100..f94609ed86 100644 --- a/python/python/tests/test_async_client.py +++ b/python/python/tests/test_async_client.py @@ -311,7 +311,7 @@ async def test_allow_opt_in_to_resp2_protocol(self, glide_client: TGlideClient): assert int(result[b"proto"]) == 2 # Testing the inflight_requests_limit parameter in glide. Sending the allowed amount + 1 of requests - # to glide, using blocking commands, and checking the N+1 request returns immediately with error. + # to glide, using blocking commands, and checking the N+1 request returns immediately with error. @pytest.mark.parametrize("cluster_mode", [False, True]) @pytest.mark.parametrize("protocol", [ProtocolVersion.RESP2, ProtocolVersion.RESP3]) @pytest.mark.parametrize("inflight_requests_limit", [5, 100, 1500]) @@ -320,9 +320,12 @@ async def test_inflight_request_limit( ): key1 = f"{{nonexistinglist}}:1-{get_random_string(10)}" test_client = await create_client( - request=request, protocol=protocol, cluster_mode=cluster_mode, inflight_requests_limit=inflight_requests_limit + request=request, + protocol=protocol, + cluster_mode=cluster_mode, + inflight_requests_limit=inflight_requests_limit, ) - + tasks = [] for i in range(inflight_requests_limit + 1): tasks.append(test_client.blpop([key1], 0))