async-redis icon indicating copy to clipboard operation
async-redis copied to clipboard

SentinelsClient: Use the given protocol to connect to sentinels

Open jlledom opened this issue 1 year ago • 0 comments

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

jlledom avatar Jan 29 '24 11:01 jlledom