Log it when we get a lock

Currently, we log it when we attempt to acquire a log, but we don't
mention it when we succesfully do acquire it. This makes people think
it's stuck.

This patch logs the succesful acquiry of locks.

Change-Id: I3b49ff331641ceafa46c93d8f5233c85fe45e5e2
This commit is contained in:
Soren Hansen
2011-12-09 14:43:38 +01:00
parent 1b788df331
commit 32841599b5

View File

@@ -719,6 +719,9 @@ def synchronized(name, external=False):
'"%(method)s"...' % {'lock': name,
'method': f.__name__}))
with sem:
LOG.debug(_('Got semaphore "%(lock)s" for method '
'"%(method)s"...' % {'lock': name,
'method': f.__name__}))
if external:
LOG.debug(_('Attempting to grab file lock "%(lock)s" for '
'method "%(method)s"...' %
@@ -730,6 +733,10 @@ def synchronized(name, external=False):
lock = _NoopContextManager()
with lock:
if external:
LOG.debug(_('Got file lock "%(lock)s" for '
'method "%(method)s"...' %
{'lock': name, 'method': f.__name__}))
retval = f(*args, **kwargs)
# If no-one else is waiting for it, delete it.