diff options
author | Greg Melton <gmelton@gmail.com> | 2022-05-30 05:45:42 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-30 15:45:42 +0300 |
commit | 48079083a7f6ac1bdd948c03175f9ffd42aa1f6b (patch) | |
tree | 30b29683a558e618ea80b1c68fc8d14498900dd1 | |
parent | 84418d62db0aef3178d5eecec47d5121ce82a1d4 (diff) | |
download | redis-py-48079083a7f6ac1bdd948c03175f9ffd42aa1f6b.tar.gz |
Fix Missing ClusterPipeline Lock (#2190)
* ClusterPipeline needs to initialize self._lock, otherwise a class instance will fail when calling get_redis_connection on the node
* fix bad lint picked up from master
* added change to CHANGES file
* force ci build again
* force ci build again
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | redis/cluster.py | 5 | ||||
-rw-r--r-- | redis/commands/json/__init__.py | 1 | ||||
-rw-r--r-- | redis/commands/timeseries/__init__.py | 1 |
4 files changed, 8 insertions, 0 deletions
@@ -9,6 +9,7 @@ * Remove verbose logging when initializing ClusterPubSub, ClusterPipeline or RedisCluster * Fix broken connection writer lock-up for asyncio (#2065) * Fix auth bug when provided with no username (#2086) + * Fix missing ClusterPipeline._lock (#2189) * 4.1.3 (Feb 8, 2022) * Fix flushdb and flushall (#1926) diff --git a/redis/cluster.py b/redis/cluster.py index fa1322f..0b9c543 100644 --- a/redis/cluster.py +++ b/redis/cluster.py @@ -754,6 +754,7 @@ class RedisCluster(AbstractRedisCluster, RedisClusterCommands): cluster_error_retry_attempts=self.cluster_error_retry_attempts, read_from_replicas=self.read_from_replicas, reinitialize_steps=self.reinitialize_steps, + lock=self._lock, ) def lock( @@ -1754,6 +1755,7 @@ class ClusterPipeline(RedisCluster): read_from_replicas=False, cluster_error_retry_attempts=5, reinitialize_steps=10, + lock=None, **kwargs, ): """ """ @@ -1776,6 +1778,9 @@ class ClusterPipeline(RedisCluster): kwargs.get("encoding_errors", "strict"), kwargs.get("decode_responses", False), ) + if lock is None: + lock = threading.Lock() + self._lock = lock def __repr__(self): """ """ diff --git a/redis/commands/json/__init__.py b/redis/commands/json/__init__.py index 638e4eb..39983be 100644 --- a/redis/commands/json/__init__.py +++ b/redis/commands/json/__init__.py @@ -113,6 +113,7 @@ class JSON(JSONCommands): cluster_error_retry_attempts=self.client.cluster_error_retry_attempts, read_from_replicas=self.client.read_from_replicas, reinitialize_steps=self.client.reinitialize_steps, + lock=self.client._lock, ) else: diff --git a/redis/commands/timeseries/__init__.py b/redis/commands/timeseries/__init__.py index 4720a43..4a6886f 100644 --- a/redis/commands/timeseries/__init__.py +++ b/redis/commands/timeseries/__init__.py @@ -77,6 +77,7 @@ class TimeSeries(TimeSeriesCommands): cluster_error_retry_attempts=self.client.cluster_error_retry_attempts, read_from_replicas=self.client.read_from_replicas, reinitialize_steps=self.client.reinitialize_steps, + lock=self.client._lock, ) else: |