Skip to content

Commit

Permalink
Merge pull request #1219 from casperisfine/sentinel-reconnection
Browse files Browse the repository at this point in the history
Fix `Redis#without_reconnect` for sentinel clients
  • Loading branch information
byroot authored Aug 17, 2023
2 parents 5d5252d + 3ea6b57 commit c92e403
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# Unreleased

- Fix `Redis#without_reconnect` for sentinel clients. Fix #1212.

# 5.0.7

- Fix compatibility with `redis-client 0.15.0` when using Redis Sentinel. Fix #1209.
Expand Down
4 changes: 0 additions & 4 deletions lib/redis/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,10 +117,6 @@ def multi
Client.translate_error!(error)
end

def disable_reconnection(&block)
ensure_connected(retryable: false, &block)
end

def inherit_socket!
@inherit_socket = true
end
Expand Down
2 changes: 1 addition & 1 deletion redis.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@ Gem::Specification.new do |s|

s.required_ruby_version = '>= 2.5.0'

s.add_runtime_dependency('redis-client', '>= 0.9.0')
s.add_runtime_dependency('redis-client', '>= 0.16.0')
end
8 changes: 8 additions & 0 deletions test/sentinel/sentinel_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ def test_sentinel_slave_role_connection
assert_equal MASTER_PORT.to_i, actual[2]
end

def test_without_reconnect
wait_for_quorum

redis.without_reconnect do
redis.get("key")
end
end

def test_the_client_can_connect_to_available_slaves
commands = {
sentinel: lambda do |*_|
Expand Down

0 comments on commit c92e403

Please sign in to comment.