redis-cluster-client 0.11.3 → 0.11.5
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/errors.rb +2 -2
- data/lib/redis_client/cluster/node.rb +1 -1
- data/lib/redis_client/cluster/optimistic_locking.rb +1 -1
- data/lib/redis_client/cluster/pipeline.rb +1 -1
- data/lib/redis_client/cluster/pub_sub.rb +7 -5
- data/lib/redis_client/cluster/router.rb +3 -3
- data/lib/redis_client/cluster/transaction.rb +1 -1
- data/lib/redis_client/cluster.rb +3 -3
- 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: 175bb2bf9b82d2b1d0b95e8d7e3e74e3952165f2edea957303f8b16716a17273
|
4
|
+
data.tar.gz: 1e094b0d0ae859cb4d77cc872203c21f2f408b739a748d518fd60ca7c33e7451
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8b8a13a4df4b5d96da3bcb618bada62d5882fb688b7fd7a9d618c6733a44913af24222c48d40f4db0a316d58b00aa608de99467114dac22711eb7b421f7e2e8a
|
7
|
+
data.tar.gz: 2c3ebd371f3a23388e6600192a6403c5f97a90f7a7c06bab747310fa729d8be8f9d7d793763a8e7829f2e4699893d76964a96bd0ea40e727d0bdb499e1ef9f67
|
@@ -37,8 +37,8 @@ class RedisClient
|
|
37
37
|
end
|
38
38
|
|
39
39
|
@errors = errors
|
40
|
-
messages = @errors.map { |node_key, error| "#{node_key}: #{error.message}" }
|
41
|
-
super(
|
40
|
+
messages = @errors.map { |node_key, error| "#{node_key}: (#{error.class}) #{error.message}" }
|
41
|
+
super(messages.join(', '))
|
42
42
|
end
|
43
43
|
end
|
44
44
|
|
@@ -309,7 +309,7 @@ class RedisClient
|
|
309
309
|
work_group.push(i, raw_client) do |client|
|
310
310
|
regular_timeout = client.read_timeout
|
311
311
|
client.read_timeout = @config.slow_command_timeout > 0.0 ? @config.slow_command_timeout : regular_timeout
|
312
|
-
reply = client.
|
312
|
+
reply = client.call_once('CLUSTER', 'NODES')
|
313
313
|
client.read_timeout = regular_timeout
|
314
314
|
parse_cluster_node_reply(reply)
|
315
315
|
rescue StandardError => e
|
@@ -33,7 +33,7 @@ class RedisClient
|
|
33
33
|
raise
|
34
34
|
end
|
35
35
|
rescue ::RedisClient::CommandError => e
|
36
|
-
@router.renew_cluster_state if e.message.start_with?('CLUSTERDOWN
|
36
|
+
@router.renew_cluster_state if e.message.start_with?('CLUSTERDOWN')
|
37
37
|
raise
|
38
38
|
end
|
39
39
|
rescue ::RedisClient::ConnectionError
|
@@ -73,7 +73,7 @@ class RedisClient
|
|
73
73
|
first_exception ||= result
|
74
74
|
end
|
75
75
|
|
76
|
-
stale_cluster_state = true if result.message.start_with?('CLUSTERDOWN
|
76
|
+
stale_cluster_state = true if result.message.start_with?('CLUSTERDOWN')
|
77
77
|
end
|
78
78
|
|
79
79
|
results[index] = result
|
@@ -35,11 +35,15 @@ class RedisClient
|
|
35
35
|
# Ruby VM allocates 1 MB memory as a stack for a thread.
|
36
36
|
# It is a fixed size but we can modify the size with some environment variables.
|
37
37
|
# So it consumes memory 1 MB multiplied a number of workers.
|
38
|
-
Thread.new(client, queue) do |pubsub, q|
|
38
|
+
Thread.new(client, queue, nil) do |pubsub, q, prev_err|
|
39
39
|
loop do
|
40
40
|
q << pubsub.next_event
|
41
|
+
prev_err = nil
|
41
42
|
rescue StandardError => e
|
43
|
+
next sleep 0.005 if e.instance_of?(prev_err.class) && e.message == prev_err&.message
|
44
|
+
|
42
45
|
q << e
|
46
|
+
prev_err = e
|
43
47
|
end
|
44
48
|
end
|
45
49
|
end
|
@@ -90,11 +94,10 @@ class RedisClient
|
|
90
94
|
|
91
95
|
case event = @queue.pop(true)
|
92
96
|
when ::RedisClient::CommandError
|
93
|
-
raise event unless event.message.start_with?('MOVED', 'CLUSTERDOWN
|
97
|
+
raise event unless event.message.start_with?('MOVED', 'CLUSTERDOWN')
|
94
98
|
|
95
99
|
break start_over
|
96
|
-
when ::RedisClient::ConnectionError
|
97
|
-
break start_over
|
100
|
+
when ::RedisClient::ConnectionError then break start_over
|
98
101
|
when StandardError then raise event
|
99
102
|
when Array then break event
|
100
103
|
end
|
@@ -161,7 +164,6 @@ class RedisClient
|
|
161
164
|
@router.renew_cluster_state
|
162
165
|
@state_dict.each_value(&:close)
|
163
166
|
@state_dict.clear
|
164
|
-
@queue.clear
|
165
167
|
@commands.each { |command| _call(command) }
|
166
168
|
break
|
167
169
|
rescue ::RedisClient::ConnectionError, ::RedisClient::Cluster::NodeMightBeDown
|
@@ -74,7 +74,7 @@ class RedisClient
|
|
74
74
|
renew_cluster_state
|
75
75
|
raise
|
76
76
|
rescue ::RedisClient::CommandError => e
|
77
|
-
renew_cluster_state if e.message.start_with?('CLUSTERDOWN
|
77
|
+
renew_cluster_state if e.message.start_with?('CLUSTERDOWN')
|
78
78
|
raise
|
79
79
|
rescue ::RedisClient::Cluster::ErrorCollection => e
|
80
80
|
raise if e.errors.any?(::RedisClient::CircuitBreaker::OpenCircuitError)
|
@@ -82,7 +82,7 @@ class RedisClient
|
|
82
82
|
renew_cluster_state if e.errors.values.any? do |err|
|
83
83
|
next false if ::RedisClient::Cluster::ErrorIdentification.identifiable?(err) && @node.none? { |c| ::RedisClient::Cluster::ErrorIdentification.client_owns_error?(err, c) }
|
84
84
|
|
85
|
-
err.message.start_with?('CLUSTERDOWN
|
85
|
+
err.message.start_with?('CLUSTERDOWN') || err.is_a?(::RedisClient::ConnectionError)
|
86
86
|
end
|
87
87
|
|
88
88
|
raise
|
@@ -123,7 +123,7 @@ class RedisClient
|
|
123
123
|
node.call('ASKING')
|
124
124
|
retry
|
125
125
|
end
|
126
|
-
elsif e.message.start_with?('CLUSTERDOWN
|
126
|
+
elsif e.message.start_with?('CLUSTERDOWN')
|
127
127
|
renew_cluster_state
|
128
128
|
retry if retry_count >= 0
|
129
129
|
end
|
@@ -170,7 +170,7 @@ class RedisClient
|
|
170
170
|
elsif err.message.start_with?('ASK')
|
171
171
|
node = @router.assign_asking_node(err.message)
|
172
172
|
try_asking(node) ? send_transaction(node, redirect: redirect - 1) : err
|
173
|
-
elsif err.message.start_with?('CLUSTERDOWN
|
173
|
+
elsif err.message.start_with?('CLUSTERDOWN')
|
174
174
|
@router.renew_cluster_state if @watching_slot.nil?
|
175
175
|
raise err
|
176
176
|
else
|
data/lib/redis_client/cluster.rb
CHANGED
@@ -15,10 +15,10 @@ class RedisClient
|
|
15
15
|
|
16
16
|
attr_reader :config
|
17
17
|
|
18
|
-
def initialize(config, pool: nil, concurrency: nil, **kwargs)
|
19
|
-
@config = config
|
18
|
+
def initialize(config = nil, pool: nil, concurrency: nil, **kwargs)
|
19
|
+
@config = config.nil? ? ClusterConfig.new(**kwargs) : config
|
20
20
|
@concurrent_worker = ::RedisClient::Cluster::ConcurrentWorker.create(**(concurrency || {}))
|
21
|
-
@command_builder = config.command_builder
|
21
|
+
@command_builder = @config.command_builder
|
22
22
|
|
23
23
|
@pool = pool
|
24
24
|
@kwargs = kwargs
|
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.11.
|
4
|
+
version: 0.11.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Taishi Kasuga
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis-client
|