redis-cluster-client 0.8.0 → 0.8.1
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 53d1591b89859ddc92dc6ca349ff211d0a6ac14c68ad72e920cc9725d82587b4
|
4
|
+
data.tar.gz: fcfeceffddc9201f8b8c5d6999d3e7aa8581c9f24f0d823b029a5561ef82887d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d51aefc48e64ef0cdbded8b5c8e4b005dcfd103d9fa4ecfa0dff1d9aa4fed5d6f6aefd4dca4ac53e89867b5276812bc6c7f8cf3cb41c1184bd9d8f19ea601471
|
7
|
+
data.tar.gz: 548da631726b4881f0a7712186f656733cb6941aef9ca3415498a6f048f59170fb74a59c30da68d655cee5e5773732d9d781c489f6cda2f0c92a341f1b28b892
|
@@ -4,7 +4,13 @@ class RedisClient
|
|
4
4
|
class Cluster
|
5
5
|
module ErrorIdentification
|
6
6
|
def self.client_owns_error?(err, client)
|
7
|
-
|
7
|
+
return true unless identifiable?(err)
|
8
|
+
|
9
|
+
err.from?(client)
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.identifiable?(err)
|
13
|
+
err.is_a?(TaggedError)
|
8
14
|
end
|
9
15
|
|
10
16
|
module TaggedError
|
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
require 'redis_client'
|
4
4
|
require 'redis_client/config'
|
5
|
-
require 'redis_client/cluster/error_identification'
|
6
5
|
require 'redis_client/cluster/errors'
|
7
6
|
require 'redis_client/cluster/node/primary_only'
|
8
7
|
require 'redis_client/cluster/node/random_replica'
|
@@ -79,11 +78,9 @@ class RedisClient
|
|
79
78
|
end
|
80
79
|
|
81
80
|
class Config < ::RedisClient::Config
|
82
|
-
def initialize(scale_read: false,
|
81
|
+
def initialize(scale_read: false, **kwargs)
|
83
82
|
@scale_read = scale_read
|
84
|
-
|
85
|
-
middlewares.unshift ErrorIdentification::Middleware
|
86
|
-
super(middlewares: middlewares, **kwargs)
|
83
|
+
super(**kwargs)
|
87
84
|
end
|
88
85
|
|
89
86
|
private
|
@@ -217,10 +214,6 @@ class RedisClient
|
|
217
214
|
end
|
218
215
|
end
|
219
216
|
|
220
|
-
def owns_error?(err)
|
221
|
-
any? { |c| ErrorIdentification.client_owns_error?(err, c) }
|
222
|
-
end
|
223
|
-
|
224
217
|
private
|
225
218
|
|
226
219
|
def make_topology_class(with_replica, replica_affinity)
|
@@ -10,6 +10,7 @@ require 'redis_client/cluster/node_key'
|
|
10
10
|
require 'redis_client/cluster/normalized_cmd_name'
|
11
11
|
require 'redis_client/cluster/transaction'
|
12
12
|
require 'redis_client/cluster/optimistic_locking'
|
13
|
+
require 'redis_client/cluster/error_identification'
|
13
14
|
|
14
15
|
class RedisClient
|
15
16
|
class Cluster
|
@@ -68,7 +69,9 @@ class RedisClient
|
|
68
69
|
raise if e.errors.any?(::RedisClient::CircuitBreaker::OpenCircuitError)
|
69
70
|
|
70
71
|
update_cluster_info! if e.errors.values.any? do |err|
|
71
|
-
|
72
|
+
next false if ::RedisClient::Cluster::ErrorIdentification.identifiable?(err) && @node.none? { |c| ::RedisClient::Cluster::ErrorIdentification.client_owns_error?(err, c) }
|
73
|
+
|
74
|
+
err.message.start_with?('CLUSTERDOWN Hash slot not served')
|
72
75
|
end
|
73
76
|
|
74
77
|
raise
|
@@ -97,7 +100,7 @@ class RedisClient
|
|
97
100
|
rescue ::RedisClient::CircuitBreaker::OpenCircuitError
|
98
101
|
raise
|
99
102
|
rescue ::RedisClient::CommandError => e
|
100
|
-
raise unless ErrorIdentification.client_owns_error?(e, node)
|
103
|
+
raise unless ::RedisClient::Cluster::ErrorIdentification.client_owns_error?(e, node)
|
101
104
|
|
102
105
|
if e.message.start_with?('MOVED')
|
103
106
|
node = assign_redirection_node(e.message)
|
@@ -117,7 +120,7 @@ class RedisClient
|
|
117
120
|
end
|
118
121
|
raise
|
119
122
|
rescue ::RedisClient::ConnectionError => e
|
120
|
-
raise unless ErrorIdentification.client_owns_error?(e, node)
|
123
|
+
raise unless ::RedisClient::Cluster::ErrorIdentification.client_owns_error?(e, node)
|
121
124
|
|
122
125
|
update_cluster_info!
|
123
126
|
|
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.8.
|
4
|
+
version: 0.8.1
|
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-04-
|
11
|
+
date: 2024-04-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: redis-client
|