From da1363f0264cf5499fcd83df14c02b49a252b3f7 Mon Sep 17 00:00:00 2001 From: Guillaume Ayoub Date: Wed, 25 May 2016 14:05:34 +0200 Subject: [PATCH] Revert "Limit duration of file locks" This reverts commit 6b1acd14d70b2e029aa56905518b3185a66d91c2. --- radicale/storage.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/radicale/storage.py b/radicale/storage.py index e11d67b..b135f20 100644 --- a/radicale/storage.py +++ b/radicale/storage.py @@ -92,7 +92,6 @@ def load(configuration, logger): MIMETYPES = {"VADDRESSBOOK": "text/vcard", "VCALENDAR": "text/calendar"} -MAX_FILE_LOCK_DURATION = 0.25 def get_etag(text): @@ -519,7 +518,6 @@ class Collection(BaseCollection): _waiters = [] _lock_file = None _lock_file_locked = False - _lock_file_time = 0 _readers = 0 _writer = False @@ -527,11 +525,6 @@ class Collection(BaseCollection): @contextmanager def acquire_lock(cls, mode): def condition(): - # Prevent starvation of writers in other processes - if cls._lock_file_locked: - time_delta = time.time() - cls._lock_file_time - if time_delta < 0 or time_delta > MAX_FILE_LOCK_DURATION: - return False if mode == "r": return not cls._writer else: @@ -585,7 +578,6 @@ class Collection(BaseCollection): except OSError: cls.logger.debug("Locking not supported") cls._lock_file_locked = True - cls._lock_file_time = time.time() yield with cls._lock: if mode == "r":