chore: renaming acquire and release methods

This commit is contained in:
hajdul88 2025-10-16 11:47:32 +02:00
parent d98838342a
commit 2bf1619e8f
3 changed files with 8 additions and 8 deletions

View file

@ -15,7 +15,7 @@ class CacheDBInterface(ABC):
self.lock = None self.lock = None
@abstractmethod @abstractmethod
def acquire(self): def acquire_lock(self):
""" """
Acquire a lock on the given key. Acquire a lock on the given key.
Must be implemented by subclasses. Must be implemented by subclasses.
@ -23,7 +23,7 @@ class CacheDBInterface(ABC):
pass pass
@abstractmethod @abstractmethod
def release(self): def release_lock(self):
""" """
Release the lock if it is held. Release the lock if it is held.
Must be implemented by subclasses. Must be implemented by subclasses.
@ -31,7 +31,7 @@ class CacheDBInterface(ABC):
pass pass
@contextmanager @contextmanager
def hold(self): def hold_lock(self):
""" """
Context manager for safely acquiring and releasing the lock. Context manager for safely acquiring and releasing the lock.
""" """

View file

@ -10,7 +10,7 @@ class RedisAdapter(CacheDBInterface):
self.timeout = timeout self.timeout = timeout
self.blocking_timeout = blocking_timeout self.blocking_timeout = blocking_timeout
def acquire(self): def acquire_lock(self):
""" """
Acquire the Redis lock manually. Raises if acquisition fails. Acquire the Redis lock manually. Raises if acquisition fails.
""" """
@ -26,7 +26,7 @@ class RedisAdapter(CacheDBInterface):
return self.lock return self.lock
def release(self): def release_lock(self):
""" """
Release the Redis lock manually, if held. Release the Redis lock manually, if held.
""" """
@ -38,7 +38,7 @@ class RedisAdapter(CacheDBInterface):
pass pass
@contextmanager @contextmanager
def hold(self): def hold_lock(self):
""" """
Context manager for acquiring and releasing the Redis lock automatically. Context manager for acquiring and releasing the Redis lock automatically.
""" """

View file

@ -225,7 +225,7 @@ class KuzuAdapter(GraphDBInterface):
lock_acquired = False lock_acquired = False
try: try:
if cache_config.shared_kuzu_lock: if cache_config.shared_kuzu_lock:
self.redis_lock.acquire() self.redis_lock.acquire_lock()
lock_acquired = True lock_acquired = True
if not self.connection: if not self.connection:
logger.info("Reconnecting to Kuzu database...") logger.info("Reconnecting to Kuzu database...")
@ -252,7 +252,7 @@ class KuzuAdapter(GraphDBInterface):
try: try:
self.close() self.close()
finally: finally:
self.redis_lock.release() self.redis_lock.release_lock()
if cache_config.shared_kuzu_lock: if cache_config.shared_kuzu_lock:
async with self._connection_change_lock: async with self._connection_change_lock: