Skip to content

Commit cfb2b7a

Browse files
committed
pipeline: properly call the passed blocks
1 parent 0e812a0 commit cfb2b7a

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

lib/redis_client/cluster/pipeline.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,45 +15,45 @@ def initialize(router, command_builder)
1515
@size = 0
1616
end
1717

18-
def call(*args, **kwargs)
18+
def call(*args, **kwargs, &block)
1919
command = @command_builder.generate(args, kwargs)
2020
node_key = @router.find_node_key(command, primary_only: true)
21-
@grouped[node_key] += [[@size, :call_v, command]]
21+
@grouped[node_key] += [[@size, :call_v, command, block]]
2222
@size += 1
2323
end
2424

25-
def call_v(args)
25+
def call_v(args, &block)
2626
command = @command_builder.generate(args)
2727
node_key = @router.find_node_key(command, primary_only: true)
28-
@grouped[node_key] += [[@size, :call_v, command]]
28+
@grouped[node_key] += [[@size, :call_v, command, block]]
2929
@size += 1
3030
end
3131

32-
def call_once(*args, **kwargs)
32+
def call_once(*args, **kwargs, &block)
3333
command = @command_builder.generate(args, kwargs)
3434
node_key = @router.find_node_key(command, primary_only: true)
35-
@grouped[node_key] += [[@size, :call_once_v, command]]
35+
@grouped[node_key] += [[@size, :call_once_v, command, block]]
3636
@size += 1
3737
end
3838

39-
def call_once_v(args)
39+
def call_once_v(args, &block)
4040
command = @command_builder.generate(args)
4141
node_key = @router.find_node_key(command, primary_only: true)
42-
@grouped[node_key] += [[@size, :call_once_v, command]]
42+
@grouped[node_key] += [[@size, :call_once_v, command, block]]
4343
@size += 1
4444
end
4545

46-
def blocking_call(timeout, *args, **kwargs)
46+
def blocking_call(timeout, *args, **kwargs, &block)
4747
command = @command_builder.generate(args, kwargs)
4848
node_key = @router.find_node_key(command, primary_only: true)
49-
@grouped[node_key] += [[@size, :blocking_call_v, timeout, command]]
49+
@grouped[node_key] += [[@size, :blocking_call_v, timeout, command, block]]
5050
@size += 1
5151
end
5252

53-
def blocking_call_v(timeout, args)
53+
def blocking_call_v(timeout, args, &block)
5454
command = @command_builder.generate(args)
5555
node_key = @router.find_node_key(command, primary_only: true)
56-
@grouped[node_key] += [[@size, :blocking_call_v, timeout, command]]
56+
@grouped[node_key] += [[@size, :blocking_call_v, timeout, command, block]]
5757
@size += 1
5858
end
5959

@@ -69,8 +69,8 @@ def execute # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Met
6969
Thread.new(@router, k, v) do |router, node_key, rows|
7070
Thread.pass
7171
replies = router.find_node(node_key).pipelined do |pipeline|
72-
rows.each do |(_size, *row)|
73-
pipeline.send(*row)
72+
rows.each do |(_size, *row, block)|
73+
pipeline.send(*row, &block)
7474
end
7575
end
7676

0 commit comments

Comments
 (0)