redis-py
redis-py copied to clipboard
Redis Cluster pipeline "exists" command error: unsupported operand type(s) for +=: 'int' and 'ClusterPipeline'
Version: redis-py version 4.1.4 and Redis version 6.2.6
Platform: Python 3.9.9 on Red Hat Enterprise Linux release 8.5
Description: We are testing the new "redis.cluster" module but when we execute the following test script:
from redis.cluster import RedisCluster
# Host "redis" is the boostrap node for the cluster
connection = RedisCluster.from_url("redis://redis:6379")
with connection.pipeline() as pipeline:
pipeline.exists("test_key")
# pipeline returns a list of responses
# https://github.com/redis/redis-py#pipelines
print(pipeline.execute()[-1])
It errors with the following stack trace:
$ python cluster-test.py
Traceback (most recent call last):
File "/opt/apps/app_root/cluster-test.py", line 6, in <module>
pipeline.exists("test_key")
File "/opt/apps/app_venv/lib/python3.9/site-packages/redis/commands/cluster.py", line 108, in exists
return self._split_command_across_slots("EXISTS", *keys)
File "/opt/apps/app_venv/lib/python3.9/site-packages/redis/commands/cluster.py", line 98, in _split_command_across_slots
total += self.execute_command(command, *slot_keys)
TypeError: unsupported operand type(s) for +=: 'int' and 'ClusterPipeline'
I tried to investigate the source code of cluster.py myself, but it's not really clear to me what the return type of self.execute_command is and why it would be ClusterPipeline in this case.
Is this a bug or are we doing something wrong?