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.
main
Selwin Ong 5 years ago committed by GitHub
parent bd0fcc1a07
commit 6a9aa1f81a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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)

Loading…
Cancel
Save