Skip to content

Async RedisCluster missing pubsub() support #2497

Closed
@itsBrady

Description

@itsBrady

Version: 4.4.0

Platform: python 3.8,

Description: async RedisCluster class does not have pubsub() function, or any pubsub commands.

Looking to move from aioredis to this library for cluster mode support. Making a simple test case I get this error:

Traceback (most recent call last):
|   File "src/test.py", line 26, in <module>
|     loop.run_until_complete(main())
|   File "/usr/local/lib/python3.8/asyncio/base_events.py", line 616, in run_until_complete
|     return future.result()
|   File "src/test.py", line 21, in main
|     test = cluster.pubsub()
| AttributeError: 'RedisCluster' object has no attribute 'pubsub'

Looking in the documentation, I see that the sync client of RedisCluster has pubsub included but not the async RedisCluster. Is there a reason for this? Any workarounds that can be shared, or is the expectation to use execute_command to manually handle these commands?

Example code:

import asyncio
import redis.asyncio as redis

cluster = redis.RedisCluster(
    host="", password="", read_from_replicas=True
)

async def main():
    await cluster.initialize()
    test = cluster.pubsub()
    await cluster.close()


loop = asyncio.get_event_loop()
loop.run_until_complete(main())
loop.close()

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions