From 4ff2d00178c1c5f3fe65c0ba6b0986df618cab78 Mon Sep 17 00:00:00 2001 From: Tobias Urdin Date: Wed, 28 Sep 2022 12:21:46 +0200 Subject: Change StrictRedis usage to Redis The StrictRedis class is only an alias for Redis in >= 3.0.0 Change-Id: Ief27531f120a50805053c214cb61bb4151678d70 --- releasenotes/notes/remove-strict-redis-f2a5a924b314de41.yaml | 4 ++++ taskflow/tests/utils.py | 2 +- taskflow/utils/redis_utils.py | 8 ++++---- 3 files changed, 9 insertions(+), 5 deletions(-) create mode 100644 releasenotes/notes/remove-strict-redis-f2a5a924b314de41.yaml diff --git a/releasenotes/notes/remove-strict-redis-f2a5a924b314de41.yaml b/releasenotes/notes/remove-strict-redis-f2a5a924b314de41.yaml new file mode 100644 index 0000000..c11467c --- /dev/null +++ b/releasenotes/notes/remove-strict-redis-f2a5a924b314de41.yaml @@ -0,0 +1,4 @@ +--- +upgrade: + - | + The minimum redis-py version required is now >= 3.0.0 diff --git a/taskflow/tests/utils.py b/taskflow/tests/utils.py index 58cd9ab..bbd4678 100644 --- a/taskflow/tests/utils.py +++ b/taskflow/tests/utils.py @@ -78,7 +78,7 @@ def zookeeper_available(min_version, timeout=3): def redis_available(min_version): - client = redis.StrictRedis() + client = redis.Redis() try: client.ping() except Exception: diff --git a/taskflow/utils/redis_utils.py b/taskflow/utils/redis_utils.py index 0d04073..aa9b143 100644 --- a/taskflow/utils/redis_utils.py +++ b/taskflow/utils/redis_utils.py @@ -33,7 +33,7 @@ def _raise_on_closed(meth): return wrapper -class RedisClient(redis.StrictRedis): +class RedisClient(redis.Redis): """A redis client that can be closed (and raises on-usage after closed). TODO(harlowja): if https://github.com/andymccurdy/redis-py/issues/613 ever @@ -48,9 +48,9 @@ class RedisClient(redis.StrictRedis): self.closed = True self.connection_pool.disconnect() - execute_command = _raise_on_closed(redis.StrictRedis.execute_command) - transaction = _raise_on_closed(redis.StrictRedis.transaction) - pubsub = _raise_on_closed(redis.StrictRedis.pubsub) + execute_command = _raise_on_closed(redis.Redis.execute_command) + transaction = _raise_on_closed(redis.Redis.transaction) + pubsub = _raise_on_closed(redis.Redis.pubsub) class UnknownExpire(enum.IntEnum): -- cgit v1.2.1