Skip to content

✨ Add BLMPOP #1199

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

Merged
merged 2 commits into from
Jun 12, 2023
Merged

✨ Add BLMPOP #1199

merged 2 commits into from
Jun 12, 2023

Conversation

JerrodCarpenter
Copy link
Contributor

  redis-rb git:(BLMPOP) ./bin/console 
irb(main):001:0> redis = Redis.new(url: "redis://localhost:6379/2")
=> #<Redis client v5.0.6 for redis://localhost:6379/2>
irb(main):002:0> redis.rpush("list", [6, 1, 2, 3, 4, 5, 6])
=> 9
irb(main):003:0> redis.lmpop(1, "list")
=> ["list", ["4"]]
irb(main):004:0> redis.blmpop(1, "list")
=> ["list", ["3"]]
irb(main):005:0> redis.blmpop(1, "list", modifier: "RIGHT")
=> ["list", ["6"]]
irb(main):006:0> redis.lmpop(1, "list1", "list", modifier: "RIGHT", count: 2)
=> ["list", ["5", "4"]]
irb(main):007:0> redis.blmpop(1, "list1", "list", modifier: "RIGHT", count: 2)
=> ["list", ["3", "2"]]

@normelton
Copy link
Contributor

Is this really the correct implementation of BLMPOP? The Redis command should block until one of the requested lists has an element. But this implementation calls LMPOP (which will immediately return nothing), and sets a timeout around it. I keep getting an empty list, without any blocking.

@byroot
Copy link
Collaborator

byroot commented Feb 20, 2025

#1310

@normelton
Copy link
Contributor

Ahh thank you!!

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

Successfully merging this pull request may close these issues.

3 participants