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 +4 -4
- data/lib/redis_client/cluster/router.rb +20 -10
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ee9d2adeb89553bf3e1bfdb3d98f1dabed5a9e4347bee756776081036a1d4341
|
|
4
|
+
data.tar.gz: 9576cdbb916ee5b1ea82b722bb41a8144f46bbd4641620c41822c89be85bcf34
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|