Use lua locks instead of pipeline locks

Lua locks are less prone to retries (and client side
flapping) so instead of using pipelines and retries on
those pipelines just use the simpler (and guaranteed
server-side atomic) lua based locks instead.

Change-Id: I3a03e040b56fd9ac97b7e5d00463ec961c81084a
This commit is contained in:
Joshua Harlow 2015-05-11 12:38:09 -07:00
parent f16972d423
commit 80f9d57791
1 changed files with 3 additions and 10 deletions

View File

@ -57,16 +57,9 @@ def _translate_failures():
class RedisLock(locking.Lock):
def __init__(self, coord, client, name, timeout):
self._name = "%s_%s_lock" % (coord.namespace, six.text_type(name))
# Avoid using lua locks to keep compatible with more versions
# of redis (and not just the ones that have lua support, also avoids
# ones that don't appear to have fully working lua support...)
#
# Issue opened: https://github.com/andymccurdy/redis-py/issues/550
#
# When that gets fixed (and detects the servers capabilities better
# we can likely turn this back on to being smart).
self._lock = redis_locks.Lock(client, self._name,
timeout=timeout, thread_local=False)
self._lock = redis_locks.LuaLock(client, self._name,
timeout=timeout,
thread_local=False)
self._coord = coord
self._acquired = False