Skip to content

async cluster does not close #3846

@amirreza-sf80

Description

@amirreza-sf80

hi 👋
the async version of cluster client does not close properly when calling aclose

In [1]: from redis.asyncio.cluster import RedisCluster

In [2]: rc = await RedisCluster(host="localhost", port=7000)

In [3]: await rc.set("a", "b")
Out[3]: True

In [4]: await rc.get("a")
Out[4]: b'b'

In [5]: await rc.aclose()

In [6]: await rc.set("a", "c")
Out[6]: True

In [7]: await rc.get("a")
Out[7]: b'c'

as you can see, even after aclose is called, you can still call operations
this is not the case with sync client

In [8]: from redis.cluster import RedisCluster

In [9]: rc = RedisCluster(host="localhost", port=7000)

In [10]: rc.set("a", "b")
Out[10]: True

In [11]: rc.get("a")
Out[11]: b'b'

In [12]: rc.close()

In [13]: rc.get("a")
...

AttributeError: 'NoneType' object has no attribute 'redis_connection'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions