From b2a2ddf08aa0dcda3c56cd68d59f2304c78cfc96 Mon Sep 17 00:00:00 2001 From: Jean Boussier Date: Thu, 20 Feb 2025 08:46:56 +0100 Subject: [PATCH] Fix Redis#blmpop to actually send BLMPOP It was mistakenly issuing a regular LMPOP. --- lib/redis/commands/lists.rb | 2 +- test/lint/lists.rb | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/redis/commands/lists.rb b/lib/redis/commands/lists.rb index 08a619a21..5700329bb 100644 --- a/lib/redis/commands/lists.rb +++ b/lib/redis/commands/lists.rb @@ -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) diff --git a/test/lint/lists.rb b/test/lint/lists.rb index ea18254df..3140bcaef 100644 --- a/test/lint/lists.rb +++ b/test/lint/lists.rb @@ -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