@@ -20,11 +20,13 @@ def initialize(config, pool: nil, **kwargs)
2020 @client_kwargs = kwargs
2121 @node = fetch_cluster_info ( @config , pool : @pool , **@client_kwargs )
2222 @command = ::RedisClient ::Cluster ::Command . load ( @node )
23+ @command_builder = @config . command_builder
2324 @mutex = Mutex . new
2425 end
2526
2627 def send_command ( method , *args , **kwargs , &block ) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/MethodLength, Metrics/PerceivedComplexity
2728 command = method == :blocking_call && args . size > 1 ? args [ 1 ..] : args
29+ command = @command_builder . generate! ( command , kwargs )
2830
2931 cmd = command . first . to_s . downcase
3032 case cmd
@@ -95,6 +97,8 @@ def try_send(node, method, *args, retry_count: 3, **kwargs, &block) # rubocop:di
9597 end
9698
9799 def scan ( *command , **kwargs ) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
100+ command = @command_builder . generate! ( command , kwargs )
101+
98102 command [ 1 ] = ZERO_CURSOR_FOR_SCAN if command . size == 1
99103 input_cursor = Integer ( command [ 1 ] )
100104
@@ -116,12 +120,14 @@ def scan(*command, **kwargs) # rubocop:disable Metrics/MethodLength, Metrics/Abc
116120 [ ( ( result_cursor << 8 ) + client_index ) . to_s , result_keys ]
117121 end
118122
119- def assign_node ( *command )
120- node_key = find_node_key ( *command )
123+ def assign_node ( *command , ** kwargs )
124+ node_key = find_node_key ( *command , ** kwargs )
121125 find_node ( node_key )
122126 end
123127
124- def find_node_key ( *command , primary_only : false )
128+ def find_node_key ( *command , primary_only : false , **kwargs )
129+ command = @command_builder . generate! ( command , kwargs )
130+
125131 key = @command . extract_first_key ( command )
126132 slot = key . empty? ? nil : ::RedisClient ::Cluster ::KeySlotConverter . convert ( key )
127133
@@ -163,6 +169,7 @@ def send_wait_command(method, *args, retry_count: 3, **kwargs, &block)
163169
164170 def send_config_command ( method , *args , **kwargs , &block )
165171 command = method == :blocking_call && args . size > 1 ? args [ 1 ..] : args
172+ command = @command_builder . generate! ( command , kwargs )
166173
167174 case command [ 1 ] . to_s . downcase
168175 when 'resetstat' , 'rewrite' , 'set'
@@ -173,6 +180,7 @@ def send_config_command(method, *args, **kwargs, &block)
173180
174181 def send_memory_command ( method , *args , **kwargs , &block )
175182 command = method == :blocking_call && args . size > 1 ? args [ 1 ..] : args
183+ command = @command_builder . generate! ( command , kwargs )
176184
177185 case command [ 1 ] . to_s . downcase
178186 when 'stats' then @node . call_all ( method , *args , **kwargs , &block )
@@ -183,6 +191,7 @@ def send_memory_command(method, *args, **kwargs, &block)
183191
184192 def send_client_command ( method , *args , **kwargs , &block )
185193 command = method == :blocking_call && args . size > 1 ? args [ 1 ..] : args
194+ command = @command_builder . generate! ( command , kwargs )
186195
187196 case command [ 1 ] . to_s . downcase
188197 when 'list' then @node . call_all ( method , *args , **kwargs , &block ) . flatten
@@ -194,6 +203,7 @@ def send_client_command(method, *args, **kwargs, &block)
194203
195204 def send_cluster_command ( method , *args , **kwargs , &block ) # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
196205 command = method == :blocking_call && args . size > 1 ? args [ 1 ..] : args
206+ command = @command_builder . generate! ( command , kwargs )
197207 subcommand = command [ 1 ] . to_s . downcase
198208
199209 case subcommand
@@ -211,6 +221,7 @@ def send_cluster_command(method, *args, **kwargs, &block) # rubocop:disable Metr
211221
212222 def send_script_command ( method , *args , **kwargs , &block )
213223 command = method == :blocking_call && args . size > 1 ? args [ 1 ..] : args
224+ command = @command_builder . generate! ( command , kwargs )
214225
215226 case command [ 1 ] . to_s . downcase
216227 when 'debug' , 'kill'
@@ -223,6 +234,7 @@ def send_script_command(method, *args, **kwargs, &block)
223234
224235 def send_pubsub_command ( method , *args , **kwargs , &block ) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
225236 command = method == :blocking_call && args . size > 1 ? args [ 1 ..] : args
237+ command = @command_builder . generate! ( command , kwargs )
226238
227239 case command [ 1 ] . to_s . downcase
228240 when 'channels' then @node . call_all ( method , *args , **kwargs , &block ) . flatten . uniq . sort_by ( &:to_s )
0 commit comments