File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed
glide/async_commands/server_modules
tests/tests_server_modules Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -213,7 +213,12 @@ async def mget(
213213 Retrieves the JSON values at the specified `path` stored at multiple `keys`.
214214
215215 Note:
216- When in cluster mode, the command may route to multiple nodes when `keys` map to different hash slots.
216+ In cluster mode, if keys in `keyValueMap` map to different hash slots, the command
217+ will be split across these slots and executed separately for each. This means the command
218+ is atomic only at the slot level. If one or more slot-specific requests fail, the entire
219+ call will return the first encountered error, even though some requests may have succeeded
220+ while others did not. If this behavior impacts your application logic, consider splitting
221+ the request into sub-requests per slot to ensure atomicity.
217222 Args:
218223 client (TGlideClient): The Redis client to execute the command.
219224 keys (List[TEncodable]): A list of keys for the JSON documents.
@@ -244,7 +249,7 @@ async def mget(
244249 if path :
245250 args .append (path )
246251
247- return cast (List [Optional [bytes ]], await client .custom_command (args ))
252+ return cast (TJsonResponse [Optional [bytes ]], await client .custom_command (args ))
248253
249254
250255async def arrappend (
Original file line number Diff line number Diff line change @@ -165,10 +165,8 @@ async def test_json_get_formatting(self, glide_client: TGlideClient):
165165 @pytest .mark .parametrize ("cluster_mode" , [True , False ])
166166 @pytest .mark .parametrize ("protocol" , [ProtocolVersion .RESP2 , ProtocolVersion .RESP3 ])
167167 async def test_json_mget (self , glide_client : TGlideClient ):
168- key = get_random_string (5 )
169- key1 = f"{{{ key } }}1"
170- key2 = f"{{{ key } }}2"
171- # The prefix ensures that both keys hash to the same slot
168+ key1 = get_random_string (5 )
169+ key2 = get_random_string (5 )
172170
173171 json1_value = {"a" : 1.0 , "b" : {"a" : 1 , "b" : 2.5 , "c" : True }}
174172 json2_value = {"a" : 3.0 , "b" : {"a" : 1 , "b" : 4 }}
You can’t perform that action at this time.
0 commit comments