redis: do not force LuaLock

LuaLock are used automatically if available by the Redis client, so
let's enjoy that. If they are not available, it'll use standard locks
anyhow.

Change-Id: Iac82622bbbf05c9472fe2c62723d46ea18ba7e6b
This commit is contained in:
Julien Danjou 2016-03-16 14:54:58 +01:00
parent 0f4e1198fd
commit 274f9a61c1
1 changed files with 3 additions and 4 deletions

View File

@ -26,7 +26,6 @@ from oslo_utils import encodeutils
from oslo_utils import strutils
import redis
from redis import exceptions
from redis import lock as redis_locks
from redis import sentinel
import six
from six.moves import map as compat_map
@ -59,9 +58,9 @@ class RedisLock(locking.Lock):
def __init__(self, coord, client, name, timeout):
name = "%s_%s_lock" % (coord.namespace, six.text_type(name))
super(RedisLock, self).__init__(name)
self._lock = redis_locks.LuaLock(client, name,
timeout=timeout,
thread_local=False)
self._lock = client.lock(name,
timeout=timeout,
thread_local=False)
self._coord = coord
self._client = client