Always log the releasing, even under failure
Cherry picked from oslo-incubator change id: I4b87b5d9e5c42a1ab4c837ebb4d45b86faf87c21 Change-Id: Iae1b9035398e283b5837a3214cf0097022af54a9 Related-Bug: #1367941
This commit is contained in:
parent
3cd82d1261
commit
671fe43039
@ -227,13 +227,15 @@ def lock(name, lock_file_prefix=None, external=False, lock_path=None):
|
||||
int_lock = internal_lock(name)
|
||||
with int_lock:
|
||||
LOG.debug('Acquired semaphore "%(lock)s"', {'lock': name})
|
||||
if external and not CONF.disable_process_locking:
|
||||
ext_lock = external_lock(name, lock_file_prefix, lock_path)
|
||||
with ext_lock:
|
||||
yield ext_lock
|
||||
else:
|
||||
yield int_lock
|
||||
LOG.debug('Releasing semaphore "%(lock)s"', {'lock': name})
|
||||
try:
|
||||
if external and not CONF.disable_process_locking:
|
||||
ext_lock = external_lock(name, lock_file_prefix, lock_path)
|
||||
with ext_lock:
|
||||
yield ext_lock
|
||||
else:
|
||||
yield int_lock
|
||||
finally:
|
||||
LOG.debug('Releasing semaphore "%(lock)s"', {'lock': name})
|
||||
|
||||
|
||||
def synchronized(name, lock_file_prefix=None, external=False, lock_path=None):
|
||||
|
Loading…
Reference in New Issue
Block a user