Skip to content

Commit e85fe3b

Browse files
authored
Fix XAUTOCLAIM to return the full response (#2252)
* fix parse_xautoclaim * linters
1 parent e5df832 commit e85fe3b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

redis/client.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,8 @@ def parse_xclaim(response, **options):
310310
def parse_xautoclaim(response, **options):
311311
if options.get("parse_justid", False):
312312
return response[1]
313-
return parse_stream_list(response[1])
313+
response[1] = parse_stream_list(response[1])
314+
return response
314315

315316

316317
def parse_xinfo_stream(response, **options):

tests/test_commands.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3781,14 +3781,14 @@ def test_xautoclaim(self, r):
37813781
# trying to claim a message that isn't already pending doesn't
37823782
# do anything
37833783
response = r.xautoclaim(stream, group, consumer2, min_idle_time=0)
3784-
assert response == []
3784+
assert response == [b"0-0", []]
37853785

37863786
# read the group as consumer1 to initially claim the messages
37873787
r.xreadgroup(group, consumer1, streams={stream: ">"})
37883788

37893789
# claim one message as consumer2
37903790
response = r.xautoclaim(stream, group, consumer2, min_idle_time=0, count=1)
3791-
assert response == [message]
3791+
assert response[1] == [message]
37923792

37933793
# reclaim the messages as consumer1, but use the justid argument
37943794
# which only returns message ids

0 commit comments

Comments
 (0)