redis-clustering 5.0.8 → 5.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/redis/cluster/client.rb +29 -12
- data/lib/redis/cluster.rb +3 -0
- metadata +6 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 48b10241c3e0f41500b8ce224013546591a034dfbc6a0fbbcbb9bef136eeca9e
|
4
|
+
data.tar.gz: 7acea63bfa0f3eab6f4c570ddb9a164f6901090964cf5988b54a913e4becc794
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7631f15ef1ce8b13d1af35f98e17f83a27b9dbd80ae8fd95c592010ed0d94dfcb3112bc1aed2e69044d9572e2cc4abe525bb88ae7bc44e72914cb66bb597a10
|
7
|
+
data.tar.gz: ce47057bada6b051033e3ca8f9338c62388b0efa530cabf8aca5210243c21deb336a7de459f7c8ce0aa638a0645eb9d1b5ec82edc6075bc73a5670bd67c2107f
|
data/lib/redis/cluster/client.rb
CHANGED
@@ -10,8 +10,9 @@ class Redis
|
|
10
10
|
RedisClient::Cluster::OrchestrationCommandNotSupported => Redis::Cluster::OrchestrationCommandNotSupported,
|
11
11
|
RedisClient::Cluster::AmbiguousNodeError => Redis::Cluster::AmbiguousNodeError,
|
12
12
|
RedisClient::Cluster::ErrorCollection => Redis::Cluster::CommandErrorCollection,
|
13
|
-
RedisClient::Cluster::Transaction::ConsistencyError => Redis::Cluster::TransactionConsistencyError
|
14
|
-
|
13
|
+
RedisClient::Cluster::Transaction::ConsistencyError => Redis::Cluster::TransactionConsistencyError,
|
14
|
+
RedisClient::Cluster::NodeMightBeDown => Redis::Cluster::NodeMightBeDown,
|
15
|
+
)
|
15
16
|
|
16
17
|
class << self
|
17
18
|
def config(**kwargs)
|
@@ -21,6 +22,29 @@ class Redis
|
|
21
22
|
def sentinel(**kwargs)
|
22
23
|
super(protocol: 2, **kwargs)
|
23
24
|
end
|
25
|
+
|
26
|
+
def translate_error!(error, mapping: ERROR_MAPPING)
|
27
|
+
case error
|
28
|
+
when RedisClient::Cluster::ErrorCollection
|
29
|
+
error.errors.each do |_node, node_error|
|
30
|
+
if node_error.is_a?(RedisClient::AuthenticationError)
|
31
|
+
raise mapping.fetch(node_error.class), node_error.message, node_error.backtrace
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
remapped_node_errors = error.errors.map do |node_key, node_error|
|
36
|
+
remapped = mapping.fetch(node_error.class, node_error.class).new(node_error.message)
|
37
|
+
remapped.set_backtrace node_error.backtrace
|
38
|
+
[node_key, remapped]
|
39
|
+
end.to_h
|
40
|
+
|
41
|
+
raise(Redis::Cluster::CommandErrorCollection.new(remapped_node_errors, error.message).tap do |remapped|
|
42
|
+
remapped.set_backtrace error.backtrace
|
43
|
+
end)
|
44
|
+
else
|
45
|
+
Redis::Client.translate_error!(error, mapping: mapping)
|
46
|
+
end
|
47
|
+
end
|
24
48
|
end
|
25
49
|
|
26
50
|
def initialize(*)
|
@@ -70,23 +94,16 @@ class Redis
|
|
70
94
|
handle_errors { super(&block) }
|
71
95
|
end
|
72
96
|
|
73
|
-
def multi(&block)
|
74
|
-
handle_errors { super(&block) }
|
97
|
+
def multi(watch: nil, &block)
|
98
|
+
handle_errors { super(watch: watch, &block) }
|
75
99
|
end
|
76
100
|
|
77
101
|
private
|
78
102
|
|
79
103
|
def handle_errors
|
80
104
|
yield
|
81
|
-
rescue RedisClient::Cluster::ErrorCollection => error
|
82
|
-
error.errors.each do |_node, node_error|
|
83
|
-
if node_error.is_a?(RedisClient::AuthenticationError)
|
84
|
-
raise ERROR_MAPPING.fetch(node_error.class), node_error.message, node_error.backtrace
|
85
|
-
end
|
86
|
-
end
|
87
|
-
raise ERROR_MAPPING.fetch(error.class), error.message, error.backtrace
|
88
105
|
rescue ::RedisClient::Error => error
|
89
|
-
|
106
|
+
Redis::Cluster::Client.translate_error!(error)
|
90
107
|
end
|
91
108
|
end
|
92
109
|
end
|
data/lib/redis/cluster.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: redis-clustering
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.0
|
4
|
+
version: 5.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ezra Zygmuntowicz
|
@@ -16,7 +16,7 @@ authors:
|
|
16
16
|
autorequire:
|
17
17
|
bindir: bin
|
18
18
|
cert_chain: []
|
19
|
-
date:
|
19
|
+
date: 2024-02-09 00:00:00.000000000 Z
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
22
22
|
name: redis
|
@@ -24,14 +24,14 @@ dependencies:
|
|
24
24
|
requirements:
|
25
25
|
- - '='
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 5.0
|
27
|
+
version: 5.1.0
|
28
28
|
type: :runtime
|
29
29
|
prerelease: false
|
30
30
|
version_requirements: !ruby/object:Gem::Requirement
|
31
31
|
requirements:
|
32
32
|
- - '='
|
33
33
|
- !ruby/object:Gem::Version
|
34
|
-
version: 5.0
|
34
|
+
version: 5.1.0
|
35
35
|
- !ruby/object:Gem::Dependency
|
36
36
|
name: redis-cluster-client
|
37
37
|
requirement: !ruby/object:Gem::Requirement
|
@@ -68,9 +68,9 @@ licenses:
|
|
68
68
|
metadata:
|
69
69
|
bug_tracker_uri: https://github.com/redis/redis-rb/issues
|
70
70
|
changelog_uri: https://github.com/redis/redis-rb/blob/master/cluster/CHANGELOG.md
|
71
|
-
documentation_uri: https://www.rubydoc.info/gems/redis/5.0
|
71
|
+
documentation_uri: https://www.rubydoc.info/gems/redis/5.1.0
|
72
72
|
homepage_uri: https://github.com/redis/redis-rb/blob/master/cluster
|
73
|
-
source_code_uri: https://github.com/redis/redis-rb/tree/v5.0
|
73
|
+
source_code_uri: https://github.com/redis/redis-rb/tree/v5.1.0/cluster
|
74
74
|
post_install_message:
|
75
75
|
rdoc_options: []
|
76
76
|
require_paths:
|