Skip to content

Commit dda594a

Browse files
authored
Fix raising command error for first command in pipeline (#788)
Also, remove a workaround that was added for a subset of commands.
1 parent 99325d4 commit dda594a

File tree

2 files changed

+5
-12
lines changed

2 files changed

+5
-12
lines changed

lib/redis.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2936,12 +2936,8 @@ def method_missing(command, *args)
29362936

29372937
FloatifyPairs =
29382938
lambda { |result|
2939-
if result.respond_to?(:each_slice)
2940-
result.each_slice(2).map do |member, score|
2941-
[member, Floatify.call(score)]
2942-
end
2943-
else
2944-
result
2939+
result.each_slice(2).map do |member, score|
2940+
[member, Floatify.call(score)]
29452941
end
29462942
}
29472943

lib/redis/client.rb

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -191,13 +191,10 @@ def call_pipelined(commands)
191191
exception = nil
192192

193193
process(commands) do
194-
result[0] = read
195-
196-
@reconnect = false
197-
198-
(commands.size - 1).times do |i|
194+
commands.size.times do |i|
199195
reply = read
200-
result[i + 1] = reply
196+
result[i] = reply
197+
@reconnect = false
201198
exception = reply if exception.nil? && reply.is_a?(CommandError)
202199
end
203200
end

0 commit comments

Comments
 (0)