mirror of
https://github.com/Kozea/Radicale.git
synced 2025-06-26 16:45:52 +00:00
Always release lock
This commit is contained in:
parent
656680d998
commit
9ade92c026
1 changed files with 23 additions and 20 deletions
|
@ -578,7 +578,9 @@ class Collection(BaseCollection):
|
|||
except OSError:
|
||||
cls.logger.debug("Locking not supported")
|
||||
cls._lock_file_locked = True
|
||||
try:
|
||||
yield
|
||||
finally:
|
||||
with cls._lock:
|
||||
if mode == "r":
|
||||
cls._readers -= 1
|
||||
|
@ -592,7 +594,8 @@ class Collection(BaseCollection):
|
|||
cls.logger.debug("Unlocking not supported")
|
||||
elif os.name == "posix":
|
||||
try:
|
||||
fcntl.lockf(cls._lock_file.fileno(), fcntl.LOCK_UN)
|
||||
fcntl.lockf(cls._lock_file.fileno(),
|
||||
fcntl.LOCK_UN)
|
||||
except OSError:
|
||||
cls.logger.debug("Unlocking not supported")
|
||||
cls._lock_file_locked = False
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue