redis-cluster-client 0.17.2 → 0.17.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 359726530c2640f2ceb9c6c06322c4608fec64338c33d3b29f675b1e152c6700
4
- data.tar.gz: ec32116a8cde689a6ea78cc029159174404288c63b452d797ff3646669b5141e
3
+ metadata.gz: ee9d2adeb89553bf3e1bfdb3d98f1dabed5a9e4347bee756776081036a1d4341
4
+ data.tar.gz: 9576cdbb916ee5b1ea82b722bb41a8144f46bbd4641620c41822c89be85bcf34
5
5
  SHA512:
6
- metadata.gz: f4b810aa80374e5720533c82846ac0485682c6b8bcd5902c6a71a9b4d2c830914a3d97cfb8c378a402b3cd44cd5a96361067d461f177d8672b918a3b6911a38d
7
- data.tar.gz: 4614bba3d265eeedf3ebe72fa75ab10ca2543a48aa0e622b530fa54ad1701af158a77819e4d0cd6aa7ce1f913df139169497caf084186eb6875a49e312b84d94
6
+ metadata.gz: 99ba847297a711cb7f1af1c05da9cf4222d00c3c89a91e4ba92b8e7eb5078275db448b46ce573b97e9fa03e40fd7cb69deac0987a43fc6be3dc3b53ea9779024
7
+ data.tar.gz: 8755ce77dfad1fc86fdb17ce63a31aa5eb71fa8aba44a84eea3194c29d2df2045dfeab48d60137d9e1032ec1cfc42a66aef732c48ba005f38da4a687c084ec8a
@@ -39,16 +39,9 @@ class RedisClient
39
39
 
40
40
  def send_command(method, command, *args, &block) # rubocop:disable Metrics/AbcSize, Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
41
41
  action = @dedicated_actions[command.first]
42
- if action.nil?
43
- cmd_spec = @command.get_spec(command)
44
- action = find_policy_action(cmd_spec)
45
- return assign_node_and_send_command(method, command, args, cmd_spec: cmd_spec, &block) if action.nil?
46
- end
47
-
48
- return send(action.method_name, method, command, args, &block) if action.reply_transformer.nil?
42
+ return send_command_by_spec(method, command, args, &block) if action.nil?
49
43
 
50
- reply = send(action.method_name, method, command, args)
51
- action.reply_transformer.call(reply).then(&TSF.call(block))
44
+ send_command_by_action(action, method, command, args, &block)
52
45
  rescue ::RedisClient::CircuitBreaker::OpenCircuitError
53
46
  raise
54
47
  rescue ::RedisClient::Cluster::Node::ReloadNeeded
@@ -258,6 +251,22 @@ class RedisClient
258
251
 
259
252
  private
260
253
 
254
+ # Follows the command tips which the server reports, or the routing by the key.
255
+ def send_command_by_spec(method, command, args, &block)
256
+ cmd_spec = @command.get_spec(command)
257
+ action = find_policy_action(cmd_spec)
258
+ return assign_node_and_send_command(method, command, args, cmd_spec: cmd_spec, &block) if action.nil?
259
+
260
+ send_command_by_action(action, method, command, args, &block)
261
+ end
262
+
263
+ def send_command_by_action(action, method, command, args, &block)
264
+ return send(action.method_name, method, command, args, &block) if action.reply_transformer.nil?
265
+
266
+ reply = send(action.method_name, method, command, args)
267
+ action.reply_transformer.call(reply).then(&TSF.call(block))
268
+ end
269
+
261
270
  def find_policy_action(cmd_spec)
262
271
  return if cmd_spec.nil?
263
272
 
@@ -331,7 +340,8 @@ class RedisClient
331
340
  if command[1].casecmp('scan').zero?
332
341
  scan(command, seed: 1, cursor_index: 2).then(&TSF.call(block))
333
342
  else
334
- assign_node(command).public_send(method, *args, command, &block)
343
+ # The other subcommands keep the default routing with the redirection handling.
344
+ send_command_by_spec(method, command, args, &block)
335
345
  end
336
346
  end
337
347
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: redis-cluster-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.17.2
4
+ version: 0.17.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Taishi Kasuga