When using redis cluster, keys in lua script should be in the same slot. In current implementation, u use KEYS for lock_name, owner, expire. In most cases, they are not in the same slot, so it will raise rediscluster.exceptions.RedisClusterException: EVALSHA - all keys must map to the same key slot if use redis-py-cluster as backend.
I think it's more reasonable to use ARGV for owner and expire as they are actually not KEYS. And with ARGV, it will be compatible to redis cluster.
When using redis cluster,
keys
in lua script should be in the same slot. In current implementation, u useKEYS
forlock_name
,owner
,expire
. In most cases, they are not in the same slot, so it will raiserediscluster.exceptions.RedisClusterException: EVALSHA - all keys must map to the same key slot
if use redis-py-cluster as backend.I think it's more reasonable to use
ARGV
forowner
andexpire
as they are actually not KEYS. And withARGV
, it will be compatible to redis cluster.