diff --git a/radicale/config.py b/radicale/config.py index 1e02656..5076ffa 100644 --- a/radicale/config.py +++ b/radicale/config.py @@ -59,7 +59,8 @@ INITIAL_CONFIG = { "filesystem_folder": os.path.expanduser( "~/.config/radicale/collections"), "fsync": "True", - "hook": ""}, + "hook": "", + "close_lock_file": "False"}, "logging": { "config": "/etc/radicale/logging", "debug": "False", diff --git a/radicale/storage.py b/radicale/storage.py index 594dc06..9fabfb3 100644 --- a/radicale/storage.py +++ b/radicale/storage.py @@ -802,3 +802,7 @@ class Collection(BaseCollection): cls._lock_file_locked = False if cls._waiters: cls._waiters[0].notify() + if (cls.configuration.getboolean("storage", "close_lock_file") + and cls._readers == 0 and not cls._waiters): + cls._lock_file.close() + cls._lock_file = None \ No newline at end of file