From a2eeae966116fbad40caa495f30e3413d8171ac4 Mon Sep 17 00:00:00 2001 From: yangdx Date: Sun, 13 Jul 2025 02:38:36 +0800 Subject: [PATCH] Fixes incorrect cleanup count --- lightrag/kg/shared_storage.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lightrag/kg/shared_storage.py b/lightrag/kg/shared_storage.py index 733861cc..3830c6dd 100644 --- a/lightrag/kg/shared_storage.py +++ b/lightrag/kg/shared_storage.py @@ -340,6 +340,9 @@ def _perform_lock_cleanup( cleaned_count = 0 new_earliest_time = None + # Calculate total count before cleanup + total_cleanup_len = len(cleanup_data) + # Perform cleanup operation for cleanup_key, cleanup_time in list(cleanup_data.items()): if current_time - cleanup_time > CLEANUP_KEYED_LOCKS_AFTER_SECONDS: @@ -369,7 +372,6 @@ def _perform_lock_cleanup( else float("inf"), MIN_CLEANUP_INTERVAL_SECONDS, ) - total_cleanup_len = len(cleanup_data) if lock_type == "async": direct_log(