Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix XAUTOCLAIM to return the full response #2252

Merged
merged 2 commits into from
Jun 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion redis/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,8 @@ def parse_xclaim(response, **options):
def parse_xautoclaim(response, **options):
if options.get("parse_justid", False):
return response[1]
return parse_stream_list(response[1])
response[1] = parse_stream_list(response[1])
return response


def parse_xinfo_stream(response, **options):
Expand Down
4 changes: 2 additions & 2 deletions tests/test_commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -3781,14 +3781,14 @@ def test_xautoclaim(self, r):
# trying to claim a message that isn't already pending doesn't
# do anything
response = r.xautoclaim(stream, group, consumer2, min_idle_time=0)
assert response == []
assert response == [b"0-0", []]

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

# claim one message as consumer2
response = r.xautoclaim(stream, group, consumer2, min_idle_time=0, count=1)
assert response == [message]
assert response[1] == [message]

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