py-sherlock / sherlock

Easy distributed locks for Python with a choice of backends.
MIT License
374 stars 35 forks source link

Redis cluster not Compatible #31

Closed yzf closed 1 year ago

yzf commented 5 years ago

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.