Skip to content

Commit

Permalink
Added inflight_requests_limit
Browse files Browse the repository at this point in the history
Signed-off-by: GilboaAWS <gilboabg@amazon.com>
  • Loading branch information
GilboaAWS committed Sep 26, 2024
1 parent 0b1352b commit 2543a4a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion python/python/glide/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion python/python/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
9 changes: 6 additions & 3 deletions python/python/tests/test_async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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])
Expand All @@ -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))
Expand Down

0 comments on commit 2543a4a

Please sign in to comment.