diff options
author | dvora-h <67596500+dvora-h@users.noreply.github.com> | 2022-03-06 13:49:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-03-06 13:49:13 +0200 |
commit | 98fd06eb8df1ecc109b4a5fb2d2a2e810142283e (patch) | |
tree | 0aec0ea9d1b87637381fbd06f7e93848ddc43433 /redis/commands/json | |
parent | c5d19b8571d2b15a29637f56a51b0da560072945 (diff) | |
download | redis-py-98fd06eb8df1ecc109b4a5fb2d2a2e810142283e.tar.gz |
Add support for JSON, TIMESERIES, BLOOM & GRAPH commands in cluster (#2032)
Co-authored-by: Chayim <chayim@users.noreply.github.com>
Diffstat (limited to 'redis/commands/json')
-rw-r--r-- | redis/commands/json/__init__.py | 30 |
1 files changed, 24 insertions, 6 deletions
diff --git a/redis/commands/json/__init__.py b/redis/commands/json/__init__.py index 12c0648..638e4eb 100644 --- a/redis/commands/json/__init__.py +++ b/redis/commands/json/__init__.py @@ -103,16 +103,34 @@ class JSON(JSONCommands): pipe.jsonget('foo') pipe.jsonget('notakey') """ - p = Pipeline( - connection_pool=self.client.connection_pool, - response_callbacks=self.MODULE_CALLBACKS, - transaction=transaction, - shard_hint=shard_hint, - ) + if isinstance(self.client, redis.RedisCluster): + p = ClusterPipeline( + nodes_manager=self.client.nodes_manager, + commands_parser=self.client.commands_parser, + startup_nodes=self.client.nodes_manager.startup_nodes, + result_callbacks=self.client.result_callbacks, + cluster_response_callbacks=self.client.cluster_response_callbacks, + cluster_error_retry_attempts=self.client.cluster_error_retry_attempts, + read_from_replicas=self.client.read_from_replicas, + reinitialize_steps=self.client.reinitialize_steps, + ) + + else: + p = Pipeline( + connection_pool=self.client.connection_pool, + response_callbacks=self.MODULE_CALLBACKS, + transaction=transaction, + shard_hint=shard_hint, + ) + p._encode = self._encode p._decode = self._decode return p +class ClusterPipeline(JSONCommands, redis.cluster.ClusterPipeline): + """Cluster pipeline for the module.""" + + class Pipeline(JSONCommands, redis.client.Pipeline): """Pipeline for the module.""" |