From 6a9aa1f81ac625a66edbebbbe900cb33ade8fedd Mon Sep 17 00:00:00 2001 From: Selwin Ong Date: Tue, 26 May 2020 20:02:44 +0700 Subject: [PATCH] Attempt to fix hmset command for Redis < 4.0 (#1260) * Attempt to fix hmset command for Redis < 4.0 * Temporarily commented out hset(key, mapping) for backward compatibility reasons. --- rq/compat/__init__.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/rq/compat/__init__.py b/rq/compat/__init__.py index d62c89c..84e7aac 100644 --- a/rq/compat/__init__.py +++ b/rq/compat/__init__.py @@ -108,8 +108,10 @@ except ImportError: def hmset(pipe_or_connection, name, mapping): # redis-py versions 3.5.0 and above accept a mapping parameter for hset - try: - return pipe_or_connection.hset(name, mapping=mapping) + # This requires Redis server >= 4.0 so this is temporarily commented out + # and will be re-enabled at a later date + # try: + # return pipe_or_connection.hset(name, mapping=mapping) # earlier versions require hmset to be used - except TypeError: - return pipe_or_connection.hmset(name, mapping) + # except TypeError: + return pipe_or_connection.hmset(name, mapping)