Skip to content

Commit 1f5274f

Browse files
committed
Fix MRI 2.3.x support with stream commands
1 parent cbf6e14 commit 1f5274f

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

lib/redis.rb

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3055,8 +3055,8 @@ def xlen(key)
30553055
# @return [Hash{String => Hash{String => Hash}}] the entries
30563056
def xread(keys, ids, count: nil, block: nil)
30573057
args = [:xread]
3058-
args.concat(['COUNT', count]) if count
3059-
args.concat(['BLOCK', block.to_i]) if block
3058+
args << 'COUNT' << count if count
3059+
args << 'BLOCK' << block.to_i if block
30603060
_xread(args, keys, ids, block)
30613061
end
30623062

@@ -3113,9 +3113,9 @@ def xgroup(subcommand, key, group, id_or_consumer = nil, mkstream: false)
31133113
# @return [Hash{String => Hash{String => Hash}}] the entries
31143114
def xreadgroup(group, consumer, keys, ids, opts = {})
31153115
args = [:xreadgroup, 'GROUP', group, consumer]
3116-
args.concat(['COUNT', opts[:count]]) if opts[:count]
3117-
args.concat(['BLOCK', opts[:block].to_i]) if opts[:block]
3118-
args << 'NOACK' if opts[:noack]
3116+
args << 'COUNT' << opts[:count] if opts[:count]
3117+
args << 'BLOCK' << opts[:block].to_i if opts[:block]
3118+
args << 'NOACK' if opts[:noack]
31193119
_xread(args, keys, ids, opts[:block])
31203120
end
31213121

@@ -3459,7 +3459,9 @@ def _subscription(method, timeout, channels, block)
34593459
def _xread(args, keys, ids, blocking_timeout_msec)
34603460
keys = keys.is_a?(Array) ? keys : [keys]
34613461
ids = ids.is_a?(Array) ? ids : [ids]
3462-
args.concat(['STREAMS'], keys, ids)
3462+
args << 'STREAMS'
3463+
args.concat(keys)
3464+
args.concat(ids)
34633465

34643466
synchronize do |client|
34653467
if blocking_timeout_msec.nil?

0 commit comments

Comments
 (0)