File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -188,6 +188,10 @@ def each_sentinel
188
188
if success
189
189
@sentinel_configs . unshift ( @sentinel_configs . delete ( sentinel_config ) )
190
190
end
191
+ # Redis Sentinels may be configured to have a lower maxclients setting than
192
+ # the Redis nodes. Close the connection to the Sentinel node to avoid using
193
+ # a connection.
194
+ sentinel_client . close
191
195
end
192
196
end
193
197
Original file line number Diff line number Diff line change @@ -50,8 +50,11 @@ def test_sentinel_all_down
50
50
end
51
51
52
52
class SentinelClientMock
53
+ attr_reader :close_count
54
+
53
55
def initialize ( responses )
54
56
@responses = responses
57
+ @close_count = 0
55
58
end
56
59
57
60
def call ( *args )
@@ -66,6 +69,10 @@ def call(*args)
66
69
raise "Expected #{ command . inspect } , got: #{ args . inspect } "
67
70
end
68
71
end
72
+
73
+ def close
74
+ @close_count += 1
75
+ end
69
76
end
70
77
71
78
def test_unknown_master
@@ -184,6 +191,7 @@ def test_successful_connection_refreshes_sentinels_list
184
191
assert_equal Servers ::SENTINELS . length + 1 , @config . sentinels . length
185
192
assert_equal new_sentinel_ip , @config . sentinels . last . host
186
193
assert_equal new_sentinel_port , @config . sentinels . last . port
194
+ assert_equal 1 , sentinel_client_mock . close_count
187
195
end
188
196
189
197
def test_sentinel_refresh_password
@@ -211,6 +219,8 @@ def test_sentinel_refresh_password
211
219
@config . sentinels . each do |sentinel |
212
220
refute_nil sentinel . password
213
221
end
222
+
223
+ assert_equal 1 , sentinel_client_mock . close_count
214
224
end
215
225
216
226
def test_config_user_password_from_url_for_redis_master_replica_only
You can’t perform that action at this time.
0 commit comments