Add debug logging to the lock manager.

Signed-off-by: Roberto Rosario <roberto.rosario.gonzalez@gmail.com>
This commit is contained in:
Roberto Rosario
2017-07-01 02:31:17 -04:00
parent 916c3497c4
commit c42a2c8a94
3 changed files with 27 additions and 3 deletions

View File

@@ -31,6 +31,7 @@ class FileLock(LockingBackend):
@classmethod
def acquire_lock(cls, name, timeout=None):
super(FileLock, cls).acquire_lock(name=name, timeout=timeout)
instance = FileLock(
name=name, timeout=timeout or setting_default_lock_timeout.value
)
@@ -38,6 +39,7 @@ class FileLock(LockingBackend):
@classmethod
def purge_locks(cls):
super(FileLock, cls).purge_locks()
lock.acquire()
with open(cls.lock_file, 'r+') as file_object:
locks.lock(f=file_object, flags=locks.LOCK_EX)
@@ -92,6 +94,8 @@ class FileLock(LockingBackend):
lock.release()
def release(self):
super(FileLock, self).release()
lock.acquire()
with open(self.__class__.lock_file, 'r+') as file_object:
locks.lock(f=file_object, flags=locks.LOCK_EX)