Avoid using a thread local token storage
When one thread is running the coordinator heartbeat() periodically and another is using the lock(s) it should be possible to correctly make this happen/work without errors of the type of: AttributeError: '_thread._local' object has no attribute 'token' This happens because the coordinator heartbeat() method calls into each current lock(s) heartbeat() method (which then extends the lock via the locks extend() method); when this is using thread local storage this fails with the above error. So to avoid this explicitly disallow using thread local token storage by ensuring we pass in the right param to the underlying redis lock. Change-Id: I8e5592813577c3cf1cf9a67d0005d1e0ef180fca
This commit is contained in:
parent
e4bbade4ef
commit
1664a04b3d
|
@ -99,7 +99,8 @@ class RedisLock(locking.Lock):
|
|||
#
|
||||
# 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)
|
||||
self._lock = redis_locks.Lock(client, self._name,
|
||||
timeout=timeout, thread_local=False)
|
||||
self._coord = coord
|
||||
self._acquired = False
|
||||
|
||||
|
|
Loading…
Reference in New Issue