summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGary Kotton <gkotton@vmware.com>2017-07-26 17:52:47 +0300
committerGary Kotton <gkotton@vmware.com>2017-07-26 17:54:27 +0300
commit9b3c8f34a92e62ce5ba13a10dd9e02f3a3105188 (patch)
treed877bb2de5039b943787658ab0d9d7d4c5be4710
parent88583edbb478c1a157b58c95c231a0b5a741b78a (diff)
downloadoslo-concurrency-9b3c8f34a92e62ce5ba13a10dd9e02f3a3105188.tar.gz
Add debug log to indicate when external lock is taken
In a case when a number of threads are concurrently accessing a resource that has a external lock there is no indication when one of the threads has taken the external lock. This patch adds in a debug log to try and add some clarity. Change-Id: Ibd7cfd3b39370b1a54f2ab50c75c6b92a876ae1a
-rw-r--r--oslo_concurrency/lockutils.py3
1 files changed, 3 insertions, 0 deletions
diff --git a/oslo_concurrency/lockutils.py b/oslo_concurrency/lockutils.py
index becda88..e896a1a 100644
--- a/oslo_concurrency/lockutils.py
+++ b/oslo_concurrency/lockutils.py
@@ -214,6 +214,9 @@ def lock(name, lock_file_prefix=None, external=False, lock_path=None,
if external and not CONF.oslo_concurrency.disable_process_locking:
ext_lock = external_lock(name, lock_file_prefix, lock_path)
ext_lock.acquire(delay=delay)
+ if do_log:
+ LOG.debug('Acquired external semaphore "%(lock)s"',
+ {'lock': name})
try:
yield ext_lock
finally: