Skip to content

Fix Redis#blmpop to actually send BLMPOP #1310

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 1 commit into from
Feb 20, 2025
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/redis/commands/lists.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def brpoplpush(source, destination, timeout: 0)
def blmpop(timeout, *keys, modifier: "LEFT", count: nil)
raise ArgumentError, "Pick either LEFT or RIGHT" unless modifier == "LEFT" || modifier == "RIGHT"

args = [:lmpop, keys.size, *keys, modifier]
args = [:blmpop, timeout, keys.size, *keys, modifier]
args << "COUNT" << Integer(count) if count

send_blocking_command(args, timeout)
Expand Down
8 changes: 4 additions & 4 deletions test/lint/lists.rb
Original file line number Diff line number Diff line change
Expand Up @@ -205,14 +205,14 @@ def test_variadic_rpoplpush_expand

def test_blmpop
target_version('7.0') do
assert_nil r.blmpop(1.0, '{1}foo')
assert_nil r.blmpop(0.1, '{1}foo')

r.lpush('{1}foo', %w[a b c d e f g])
assert_equal ['{1}foo', ['g']], r.blmpop(1.0, '{1}foo')
assert_equal ['{1}foo', ['f', 'e']], r.blmpop(1.0, '{1}foo', count: 2)
assert_equal ['{1}foo', ['g']], r.blmpop(0.1, '{1}foo')
assert_equal ['{1}foo', ['f', 'e']], r.blmpop(0.1, '{1}foo', count: 2)

r.lpush('{1}foo2', %w[a b])
assert_equal ['{1}foo', ['a']], r.blmpop(1.0, '{1}foo', '{1}foo2', modifier: "RIGHT")
assert_equal ['{1}foo', ['a']], r.blmpop(0.1, '{1}foo', '{1}foo2', modifier: "RIGHT")
end
end

Expand Down