diff --git a/analysis/concurrent_knowledge.py b/analysis/concurrent_knowledge.py index ee993a0..6e14456 100644 --- a/analysis/concurrent_knowledge.py +++ b/analysis/concurrent_knowledge.py @@ -50,10 +50,11 @@ def _acquire_lock(self, timeout: float = 10.0) -> Any: try: portalocker.lock(lock_file, portalocker.LOCK_EX | portalocker.LOCK_NB) return lock_file - except OSError: + except (OSError, portalocker.exceptions.LockException) as exc: + # Retry until timeout to handle concurrent access across processes if time.time() - start_time > timeout: lock_file.close() - raise TimeoutError(f"Lock timeout: {self.file_path}") + raise TimeoutError(f"Lock timeout: {self.file_path}") from exc time.sleep(0.05) def _release_lock(self, lock_file: Any):