redis-cluster-client 0.4.8 → 0.4.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/redis_client/cluster/pub_sub.rb +21 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19e03bc6e2b6ddf57697c9e63dd5ffa729e6621979b3daef02b28062dc328494
|
4
|
+
data.tar.gz: f212df153cda0c53710c5f03586c01042d168380982113e4dd354ae859c276b4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e6034b7693d67eaec5e979fe5cce0c310746262971a77642392930ee1dc2be2cefcad6ac3729cc8d11fb3a2d3ba1077ee2aacfef618fc570c688850056f1c1f6
|
7
|
+
data.tar.gz: 5182806018f1452094085cea4f2c1bd70ecbfe71d4d5b178fec7f06712debd4cb843fb794ab1b1d29df61204a14db9a0e92eb133f40ffcb732397dd76c7e199f
|
@@ -1,5 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'redis_client'
|
4
|
+
|
3
5
|
class RedisClient
|
4
6
|
class Cluster
|
5
7
|
class PubSub
|
@@ -76,8 +78,26 @@ class RedisClient
|
|
76
78
|
|
77
79
|
def _call(command)
|
78
80
|
node_key = @router.find_node_key(command)
|
79
|
-
|
81
|
+
add_state(node_key)
|
82
|
+
try_call(node_key, command)
|
83
|
+
end
|
84
|
+
|
85
|
+
def try_call(node_key, command, retry_count: 1)
|
80
86
|
@states[node_key].call(command)
|
87
|
+
rescue ::RedisClient::CommandError => e
|
88
|
+
raise if !e.message.start_with?('MOVED') || retry_count <= 0
|
89
|
+
|
90
|
+
# for sharded pub/sub
|
91
|
+
node_key = e.message.split[2]
|
92
|
+
add_state(node_key)
|
93
|
+
retry_count -= 1
|
94
|
+
retry
|
95
|
+
end
|
96
|
+
|
97
|
+
def add_state(node_key)
|
98
|
+
return @states[node_key] if @states.key?(node_key)
|
99
|
+
|
100
|
+
@states[node_key] = State.new(@router.find_node(node_key).pubsub)
|
81
101
|
end
|
82
102
|
|
83
103
|
def obtain_current_time
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-cluster-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taishi Kasuga
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-08-
|
11
|
+
date: 2023-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis-client
|