Skip to content

Commit

Permalink
Fix Redis#blmpop to actually send BLMPOP
Browse files Browse the repository at this point in the history
It was mistakenly issuing a regular LMPOP.
  • Loading branch information
byroot committed Feb 20, 2025
1 parent 2a4544c commit 709573c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
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, 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

0 comments on commit 709573c

Please sign in to comment.