Skip to content

xautoclaim discards first reply part (id of last scanned stream item) #2226

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

Closed
vvnekb opened this issue Jun 10, 2022 · 1 comment · Fixed by #2252
Closed

xautoclaim discards first reply part (id of last scanned stream item) #2226

vvnekb opened this issue Jun 10, 2022 · 1 comment · Fixed by #2252
Labels
bug Bug

Comments

@vvnekb
Copy link

vvnekb commented Jun 10, 2022

Version: redis-py 4.3.3, redis 7.0.0

Platform: python 3.9, ubuntu 20.04

Description: I tried to implement the iterative XAUTOCLAIM as described in Redis docs:

The command returns the claimed entries as an array. It also returns a stream ID intended for cursor-like use as the argument for its subsequent call. When there are no remaining PEL entries, the command returns the special 0-0 ID to signal completion.

...

Return
Array reply, specifically:
An array with three elements:

  1. A stream ID to be used as the argument for the next call to XAUTOCLAIM.
  2. An array containing all the successfully claimed messages in the same format as XRANGE.
  3. An array containing message IDs that no longer exist in the stream, and were deleted from the PEL in which they were found.

Unfortunately, I found out that redis-py drops first element of array completely and returns just the second part (claimed messages), as can be seen in parse_xautoclaim. So it is not possible to figure out the start_id for the next call.

What is the rationale behind that decision? It looks like there are cases when id of last scanned stream item is quite useful.

@dvora-h
Copy link
Collaborator

dvora-h commented Jun 27, 2022

@vvnekb Thanks for reporting this issue! I don't know what is the reason to return only the second element on the response and I think it's really make sense to return all of it so I fixed it in this PR #2252

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants