From 3d8e6924bc849a7789de5830b78f460973f874a6 Mon Sep 17 00:00:00 2001 From: yangdx Date: Sat, 12 Jul 2025 02:58:05 +0800 Subject: [PATCH] Show lock clean up message --- lightrag/kg/shared_storage.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/lightrag/kg/shared_storage.py b/lightrag/kg/shared_storage.py index fe7e7e00..02b6c245 100644 --- a/lightrag/kg/shared_storage.py +++ b/lightrag/kg/shared_storage.py @@ -341,11 +341,12 @@ def _release_shared_raw_mp_lock(factory_name: str, key: str): _lock_registry_count.pop(cleanup_key, None) _lock_cleanup_data.pop(cleanup_key, None) cleaned_count += 1 - direct_log( - f"== mp Lock == Cleaned up {cleaned_count}/{total_cleanup_len} expired locks", - enable_output=False, - level="DEBUG", - ) + if cleaned_count > 0: + direct_log( + f"== mp Lock == Cleaned up {cleaned_count}/{total_cleanup_len} expired locks", + enable_output=False, + level="INFO", + ) class KeyedUnifiedLock: @@ -423,11 +424,12 @@ class KeyedUnifiedLock: self._async_lock_count.pop(cleanup_key) self._async_lock_cleanup_data.pop(cleanup_key) cleaned_count += 1 - direct_log( - f"== async Lock == Cleaned up {cleaned_count}/{total_cleanup_len} expired async locks", - enable_output=False, - level="DEBUG", - ) + if cleaned_count > 0: + direct_log( + f"== async Lock == Cleaned up {cleaned_count}/{total_cleanup_len} expired async locks", + enable_output=False, + level="INFO", + ) def _get_lock_for_key(self, key: str, enable_logging: bool = False) -> UnifiedLock: # 1. get (or create) the per‑process async gate for this key