Show lock clean up message

This commit is contained in:
yangdx 2025-07-12 02:58:05 +08:00
parent 22c36f2fd2
commit 3d8e6924bc

View file

@ -341,11 +341,12 @@ def _release_shared_raw_mp_lock(factory_name: str, key: str):
_lock_registry_count.pop(cleanup_key, None) _lock_registry_count.pop(cleanup_key, None)
_lock_cleanup_data.pop(cleanup_key, None) _lock_cleanup_data.pop(cleanup_key, None)
cleaned_count += 1 cleaned_count += 1
direct_log( if cleaned_count > 0:
f"== mp Lock == Cleaned up {cleaned_count}/{total_cleanup_len} expired locks", direct_log(
enable_output=False, f"== mp Lock == Cleaned up {cleaned_count}/{total_cleanup_len} expired locks",
level="DEBUG", enable_output=False,
) level="INFO",
)
class KeyedUnifiedLock: class KeyedUnifiedLock:
@ -423,11 +424,12 @@ class KeyedUnifiedLock:
self._async_lock_count.pop(cleanup_key) self._async_lock_count.pop(cleanup_key)
self._async_lock_cleanup_data.pop(cleanup_key) self._async_lock_cleanup_data.pop(cleanup_key)
cleaned_count += 1 cleaned_count += 1
direct_log( if cleaned_count > 0:
f"== async Lock == Cleaned up {cleaned_count}/{total_cleanup_len} expired async locks", direct_log(
enable_output=False, f"== async Lock == Cleaned up {cleaned_count}/{total_cleanup_len} expired async locks",
level="DEBUG", enable_output=False,
) level="INFO",
)
def _get_lock_for_key(self, key: str, enable_logging: bool = False) -> UnifiedLock: def _get_lock_for_key(self, key: str, enable_logging: bool = False) -> UnifiedLock:
# 1. get (or create) the perprocess async gate for this key # 1. get (or create) the perprocess async gate for this key