Skip to content

Commit 709573c

Browse files
committed
Fix Redis#blmpop to actually send BLMPOP
It was mistakenly issuing a regular LMPOP.
1 parent 2a4544c commit 709573c

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/redis/commands/lists.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ def brpoplpush(source, destination, timeout: 0)
205205
def blmpop(timeout, *keys, modifier: "LEFT", count: nil)
206206
raise ArgumentError, "Pick either LEFT or RIGHT" unless modifier == "LEFT" || modifier == "RIGHT"
207207

208-
args = [:lmpop, keys.size, *keys, modifier]
208+
args = [:blmpop, keys.size, *keys, modifier]
209209
args << "COUNT" << Integer(count) if count
210210

211211
send_blocking_command(args, timeout)

test/lint/lists.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -205,14 +205,14 @@ def test_variadic_rpoplpush_expand
205205

206206
def test_blmpop
207207
target_version('7.0') do
208-
assert_nil r.blmpop(1.0, '{1}foo')
208+
assert_nil r.blmpop(0.1, '{1}foo')
209209

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

214214
r.lpush('{1}foo2', %w[a b])
215-
assert_equal ['{1}foo', ['a']], r.blmpop(1.0, '{1}foo', '{1}foo2', modifier: "RIGHT")
215+
assert_equal ['{1}foo', ['a']], r.blmpop(0.1, '{1}foo', '{1}foo2', modifier: "RIGHT")
216216
end
217217
end
218218

0 commit comments

Comments
 (0)