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

Claiming trimmed messages from a stream leads to an error #936

Open
flash-gordon opened this issue Aug 20, 2020 · 2 comments
Open

Claiming trimmed messages from a stream leads to an error #936

flash-gordon opened this issue Aug 20, 2020 · 2 comments

Comments

@flash-gordon
Copy link

flash-gordon commented Aug 20, 2020

What happens:

  1. Consumer reads a message then fails.
  2. The message is added to the list of pending.
  3. After a while, the stream is trimmed and the message is removed yet it's still on the list of pending.
  4. Recover process tries to claim the message, redis-rb throws an error;
redis.xclaim(stream, consumer_group, consumer, 0, [pending_id])
       undefined method `each_slice' for nil:NilClass
     # redis-4.2.1/lib/redis.rb:3428:in `block (2 levels) in <class:Redis>'
     # redis-4.2.1/lib/redis.rb:3427:in `map'
     # redis-4.2.1/lib/redis.rb:3427:in `block in <class:Redis>'
     # redis-4.2.1/lib/redis/client.rb:130:in `call'
     # redis-4.2.1/lib/redis.rb:3222:in `block in xclaim'
     # redis-4.2.1/lib/redis.rb:69:in `block in synchronize'
     # /Users/gordon/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/monitor.rb:202:in `synchronize'
     # /Users/gordon/.rvm/rubies/ruby-2.7.1/lib/ruby/2.7.0/monitor.rb:202:in `mon_synchronize'
     # redis-4.2.1/lib/redis.rb:69:in `synchronize'
     # redis-4.2.1/lib/redis.rb:3222:in `xclaim'

I think trimmed messages should result in nil.

@flash-gordon
Copy link
Author

There's justid option in xclaim that will avoid hashifying fetched records. Still, the current error is confusing, it'd be better to have MessageDeletedError or something like that.

@supercaracal
Copy link
Contributor

It seems like that the error is related to #929.

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

No branches or pull requests

2 participants