Skip to content

AsyncScript not working in async RedisCluster #2449

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ttecles opened this issue Nov 9, 2022 · 2 comments
Closed

AsyncScript not working in async RedisCluster #2449

ttecles opened this issue Nov 9, 2022 · 2 comments

Comments

@ttecles
Copy link

ttecles commented Nov 9, 2022

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'
@chayim chayim added the bug Bug label Nov 17, 2022
@KMilhan
Copy link
Contributor

KMilhan commented Dec 13, 2022

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

@uglide
Copy link
Contributor

uglide commented Feb 8, 2023

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants