Skip to content

Ssubscribe not honoring read_from_replicas flag #3266

Description

@thx123

Thanks for wanting to report an issue you've found in redis-py. Please delete this text and fill in the template below.
It is of course not always possible to reduce your code to a small test case, but it's highly appreciated to have as much data as possible. Thank you!

Version: 5.0.4

Platform: Python 3.9 on Macbook Pro running Sonoma 14.5 (23F79) (applies to other platforms as well)

Description: Sharded subscribe is not honoring the read_from_replicas flag for the class RedisCluster. In particular, it's calling:

node = self.cluster.get_node_from_key(s_channel)

which has the following signature:

    def get_node_from_key(self, key, replica=False):
        """
        Get the node that holds the key's slot.
        If replica set to True but the slot doesn't have any replicas, None is
        returned.
        """

As such, only primary replicas are used for sharded subscribe. It'd be great if ssubscribe behaves in the same way as subscribe to be consistent with the definition of the read_from_replicas flag. Thanks!

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