async-redis
async-redis copied to clipboard
SentinelsClient: Use the given protocol to connect to sentinels
I was trying to connect to some sentinels that require password authentication. For that, I created a new protocol as in the example: https://github.com/socketry/async-redis/blob/main/examples/auth/protocol.rb
class AuthenticatedRESP2
def initialize(password)
@password = password
end
def client(stream)
client = Async::Redis::Protocol::RESP2.client(stream)
client.write_request(["AUTH", *@password])
client.read_response # Ignore response.
client
end
end
When SentinelsClient
is used, it ignores the provided protocol when it tries to resolve address for master and slaves. As a result, password protected sentinels are not supported by async-redis.
This PR includes a small change to fix that.
Types of Changes
- Bug fix.
Contribution
- [ ] I added tests for my changes.
- [x] I tested my changes locally.
- [x] I agree to the Developer's Certificate of Origin 1.1.