redis-client 0.26.3 → 0.26.4
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/CHANGELOG.md +5 -0
- data/lib/redis_client/sentinel_config.rb +9 -4
- data/lib/redis_client/version.rb +1 -1
- 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: 154a0c259fc2b3ccd21836d769541db74daef95be9d2e235a36c15b8b6d68d3b
|
|
4
|
+
data.tar.gz: 5f27693c2903da092547ad8f4362a1573e8527d9ef38266074c389574523971b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ca23aa033f2142cd608cf6197a35b0e32c89f1240344853be148b9eefbec330bbf1a8507277c822482455a8e7198abec888ce73c1f842382d5ebc826c417c5d2
|
|
7
|
+
data.tar.gz: e5f2086185d04e12462dc176a3c90084d7a7b04c520f906dcdb6024a1a42a6d7b418d5c94951628062a746ed0a0426add0970d877587f6b3d25843baf2c0a780
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Unreleased
|
|
2
2
|
|
|
3
|
+
# 0.26.4
|
|
4
|
+
|
|
5
|
+
- Further improve `rediss://` URLs used with Redis sentinel. Now avoid override explictly set `ssl:` paramter.
|
|
6
|
+
- Fix compatibility with `redis-rb` in sentinel mode.
|
|
7
|
+
|
|
3
8
|
# 0.26.3
|
|
4
9
|
|
|
5
10
|
- Fix `rediss://` (ssl) URLs used with Redis sentinel.
|
|
@@ -22,6 +22,9 @@ class RedisClient
|
|
|
22
22
|
raise ArgumentError, "Expected role to be either :master or :replica, got: #{role.inspect}"
|
|
23
23
|
end
|
|
24
24
|
|
|
25
|
+
# Track whether SSL was explicitly provided by user
|
|
26
|
+
ssl_explicitly_set = client_config.key?(:ssl)
|
|
27
|
+
|
|
25
28
|
if url
|
|
26
29
|
url_config = URLConfig.new(url)
|
|
27
30
|
client_config = {
|
|
@@ -68,7 +71,9 @@ class RedisClient
|
|
|
68
71
|
client_config[:reconnect_attempts] ||= DEFAULT_RECONNECT_ATTEMPTS
|
|
69
72
|
@client_config = client_config || {}
|
|
70
73
|
@sentinel_client_config = @client_config.dup
|
|
71
|
-
|
|
74
|
+
# Only remove SSL from sentinel config if it was derived from URL,
|
|
75
|
+
# not if explicitly set by user.
|
|
76
|
+
@sentinel_client_config.delete(:ssl) unless ssl_explicitly_set
|
|
72
77
|
super(**client_config)
|
|
73
78
|
@sentinel_configs = sentinels_to_configs(sentinels)
|
|
74
79
|
end
|
|
@@ -155,7 +160,7 @@ class RedisClient
|
|
|
155
160
|
|
|
156
161
|
def resolve_master
|
|
157
162
|
each_sentinel do |sentinel_client|
|
|
158
|
-
host, port = sentinel_client.
|
|
163
|
+
host, port = sentinel_client.call_v(["SENTINEL", "get-master-addr-by-name", @name])
|
|
159
164
|
next unless host && port
|
|
160
165
|
|
|
161
166
|
refresh_sentinels(sentinel_client)
|
|
@@ -174,7 +179,7 @@ class RedisClient
|
|
|
174
179
|
|
|
175
180
|
def resolve_replica
|
|
176
181
|
each_sentinel do |sentinel_client|
|
|
177
|
-
replicas = sentinel_client.
|
|
182
|
+
replicas = sentinel_client.call_v(["SENTINEL", "replicas", @name], &@to_list_of_hash)
|
|
178
183
|
replicas.reject! do |r|
|
|
179
184
|
flags = r["flags"].to_s.split(",")
|
|
180
185
|
flags.include?("s_down") || flags.include?("o_down")
|
|
@@ -217,7 +222,7 @@ class RedisClient
|
|
|
217
222
|
end
|
|
218
223
|
|
|
219
224
|
def refresh_sentinels(sentinel_client)
|
|
220
|
-
sentinel_response = sentinel_client.
|
|
225
|
+
sentinel_response = sentinel_client.call_v(["SENTINEL", "sentinels", @name], &@to_list_of_hash)
|
|
221
226
|
sentinels = sentinel_response.map do |sentinel|
|
|
222
227
|
{ host: sentinel.fetch("ip"), port: Integer(sentinel.fetch("port")) }
|
|
223
228
|
end
|
data/lib/redis_client/version.rb
CHANGED