redis/redis-py

AsyncScript not working in async RedisCluster

Closed this issue · 2 comments

Version: 4.3.4
Platform: Ubuntu 22.04

Description: AsyncScript not working in async RedisCluster but it does work on a synchronous version

>>> from redis.asyncio.cluster import RedisCluster
>>> cluster = RedisCluster(host='localhost', port=6379, decode_responses=True, protocol_version=2)
>>> LUA_SCRIPT = '''
if ARGV[2] == redis.call('GET', KEYS[1]) then
    return redis.call('SET', KEYS[1], ARGV[1])
else
    error("key has changed")
end
'''
>>> cluster.register_script(LUA_SCRIPT)
Traceback (most recent call last):
  File "/home/joan/.pyenv/versions/3.10.5/lib/python3.10/code.py", line 90, in runcode
    exec(code, self.locals)
  File "<input>", line 1, in <module>
  File "/home/joan/virtualenvs/product-images/lib/python3.10/site-packages/redis/commands/core.py", line 5186, in register_script
    return AsyncScript(self, script)
  File "/home/joan/virtualenvs/product-images/lib/python3.10/site-packages/redis/commands/core.py", line 4960, in __init__
    encoder = registered_client.connection_pool.get_encoder()
AttributeError: 'RedisCluster' object has no attribute 'connection_pool'

Could you try the latest version? I believe #2420 solved the issue.

@ttecles The issue is not reproducible on 4.4.0. Please upgrade to the latest version.