This commit is contained in:
retoor 2026-01-06 13:58:50 +01:00
parent 24385839c4
commit 5cffab48c7

View File

@ -233,6 +233,7 @@ class PersistentWebDAVLocks:
async def _load_locks_from_db(self):
if not self.db_manager:
return
expired_hashes = []
try:
async with self.db_manager.get_master_connection() as conn:
cursor = await conn.execute("SELECT * FROM webdav_locks")
@ -251,10 +252,12 @@ class PersistentWebDAVLocks:
if not lock_info.is_expired:
self.locks[lock_info.path_hash] = lock_info
else:
await self._delete_lock_from_db(lock_info.path_hash)
expired_hashes.append(lock_info.path_hash)
logger.info(f"Loaded {len(self.locks)} WebDAV locks from database")
except Exception as e:
logger.error(f"Failed to load WebDAV locks: {e}")
for path_hash in expired_hashes:
await self._delete_lock_from_db(path_hash)
async def _save_all_locks(self):
if not self._persistence_enabled: