Skip to content

SentinelConnectionPool does not retrieve updated master address from Sentinel on connection retries #3874

@SamuelGD

Description

@SamuelGD

Description:
When the Redis master address changes (e.g., after a Sentinel failover), the Redis client using a SentinelConnectionPool does not fetch the updated master address during connection retries.

Currently, only the connect method in SentinelManagedConnection retrieves the master address from Sentinel https://github.com/redis/redis-py/blob/v7.1.0/redis/asyncio/sentinel.py#L53.

However, on retries, connect_check_health call the internal _connect method, which does not update the master address: https://github.com/redis/redis-py/blob/v7.1.0/redis/asyncio/connection.py#L306-L311.

As a result, the client may continue attempting to connect to the old master.

Expected behavior:
Retries should retrieve the latest master address from Sentinel, ensuring the client reconnects to the correct master after a failover.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions