diff --git a/cognee/infrastructure/databases/cache/cache_db_interface.py b/cognee/infrastructure/databases/cache/cache_db_interface.py index 57e9a2ecd..ae8f22f35 100644 --- a/cognee/infrastructure/databases/cache/cache_db_interface.py +++ b/cognee/infrastructure/databases/cache/cache_db_interface.py @@ -15,7 +15,7 @@ class CacheDBInterface(ABC): self.lock = None @abstractmethod - def acquire(self): + def acquire_lock(self): """ Acquire a lock on the given key. Must be implemented by subclasses. @@ -23,7 +23,7 @@ class CacheDBInterface(ABC): pass @abstractmethod - def release(self): + def release_lock(self): """ Release the lock if it is held. Must be implemented by subclasses. @@ -31,7 +31,7 @@ class CacheDBInterface(ABC): pass @contextmanager - def hold(self): + def hold_lock(self): """ Context manager for safely acquiring and releasing the lock. """ diff --git a/cognee/infrastructure/databases/cache/redis/RedisAdapter.py b/cognee/infrastructure/databases/cache/redis/RedisAdapter.py index 3d656ac90..99c8ebdd9 100644 --- a/cognee/infrastructure/databases/cache/redis/RedisAdapter.py +++ b/cognee/infrastructure/databases/cache/redis/RedisAdapter.py @@ -27,7 +27,7 @@ class RedisAdapter(CacheDBInterface): self.timeout = timeout self.blocking_timeout = blocking_timeout - def acquire(self): + def acquire_lock(self): """ Acquire the Redis lock manually. Raises if acquisition fails. (Sync because of Kuzu) """ @@ -43,7 +43,7 @@ class RedisAdapter(CacheDBInterface): return self.lock - def release(self): + def release_lock(self): """ Release the Redis lock manually, if held. (Sync because of Kuzu) """ @@ -55,7 +55,7 @@ class RedisAdapter(CacheDBInterface): pass @contextmanager - def hold(self): + def hold_lock(self): """ Context manager for acquiring and releasing the Redis lock automatically. (Sync because of Kuzu) """ diff --git a/cognee/infrastructure/databases/graph/kuzu/adapter.py b/cognee/infrastructure/databases/graph/kuzu/adapter.py index ae9556b63..3f0fb0c57 100644 --- a/cognee/infrastructure/databases/graph/kuzu/adapter.py +++ b/cognee/infrastructure/databases/graph/kuzu/adapter.py @@ -225,7 +225,7 @@ class KuzuAdapter(GraphDBInterface): lock_acquired = False try: if cache_config.shared_kuzu_lock: - self.redis_lock.acquire() + self.redis_lock.acquire_lock() lock_acquired = True if not self.connection: logger.info("Reconnecting to Kuzu database...") @@ -252,7 +252,7 @@ class KuzuAdapter(GraphDBInterface): try: self.close() finally: - self.redis_lock.release() + self.redis_lock.release_lock() if cache_config.shared_kuzu_lock: async with self._connection_change_lock: