From 2bf1619e8f05dc9cdf83628a3a1505e611d2c96d Mon Sep 17 00:00:00 2001 From: hajdul88 <52442977+hajdul88@users.noreply.github.com> Date: Thu, 16 Oct 2025 11:47:32 +0200 Subject: [PATCH] chore: renaming acquire and release methods --- cognee/infrastructure/databases/cache/cache_db_interface.py | 6 +++--- cognee/infrastructure/databases/cache/redis/RedisAdapter.py | 6 +++--- cognee/infrastructure/databases/graph/kuzu/adapter.py | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/cognee/infrastructure/databases/cache/cache_db_interface.py b/cognee/infrastructure/databases/cache/cache_db_interface.py index a70b3fc9c..0c0b578f8 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 b0d0e6886..70c8de9bb 100644 --- a/cognee/infrastructure/databases/cache/redis/RedisAdapter.py +++ b/cognee/infrastructure/databases/cache/redis/RedisAdapter.py @@ -10,7 +10,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. """ @@ -26,7 +26,7 @@ class RedisAdapter(CacheDBInterface): return self.lock - def release(self): + def release_lock(self): """ Release the Redis lock manually, if held. """ @@ -38,7 +38,7 @@ class RedisAdapter(CacheDBInterface): pass @contextmanager - def hold(self): + def hold_lock(self): """ Context manager for acquiring and releasing the Redis lock automatically. """ 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: