diff options
author | Milhan <kimmilhan@gmail.com> | 2022-11-09 21:22:05 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-11-09 14:22:05 +0200 |
commit | 772079fabd7453edf3788d0c31b9caf21ff5deca (patch) | |
tree | 32c6be41e88676ae2f24c4689ad651e99ac16665 /redis/commands/core.py | |
parent | 1cdba6302c694e2d0aaca1e336185217fdc1c136 (diff) | |
download | redis-py-772079fabd7453edf3788d0c31b9caf21ff5deca.tar.gz |
Enable AsyncIO cluster mode lock (#2446)
Co-authored-by: Chayim <chayim@users.noreply.github.com>
Diffstat (limited to 'redis/commands/core.py')
-rw-r--r-- | redis/commands/core.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/redis/commands/core.py b/redis/commands/core.py index c245a7a..3be2823 100644 --- a/redis/commands/core.py +++ b/redis/commands/core.py @@ -4930,7 +4930,11 @@ class Script: if isinstance(script, str): # We need the encoding from the client in order to generate an # accurate byte representation of the script - encoder = registered_client.connection_pool.get_encoder() + try: + encoder = registered_client.connection_pool.get_encoder() + except AttributeError: + # Cluster + encoder = registered_client.get_encoder() script = encoder.encode(script) self.sha = hashlib.sha1(script).hexdigest() @@ -4975,7 +4979,11 @@ class AsyncScript: if isinstance(script, str): # We need the encoding from the client in order to generate an # accurate byte representation of the script - encoder = registered_client.connection_pool.get_encoder() + try: + encoder = registered_client.connection_pool.get_encoder() + except AttributeError: + # Cluster + encoder = registered_client.get_encoder() script = encoder.encode(script) self.sha = hashlib.sha1(script).hexdigest() |