redis-rb
redis-rb copied to clipboard
Claiming trimmed messages from a stream leads to an error
What happens:
- Consumer reads a message then fails.
- The message is added to the list of pending.
- After a while, the stream is trimmed and the message is removed yet it's still on the list of pending.
- Recover process tries to claim the message,
redis-rbthrows 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.
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.
It seems like that the error is related to #929.