From 913fa1e4153e39f4f8af1a18810af52cc459df07 Mon Sep 17 00:00:00 2001 From: yangdx Date: Sun, 9 Nov 2025 23:04:04 +0800 Subject: [PATCH] Add concurrency warning for JsonKVStorage in cleanup tool --- lightrag/tools/clean_llm_query_cache.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/lightrag/tools/clean_llm_query_cache.py b/lightrag/tools/clean_llm_query_cache.py index 1b688c29..eca658c7 100644 --- a/lightrag/tools/clean_llm_query_cache.py +++ b/lightrag/tools/clean_llm_query_cache.py @@ -873,6 +873,31 @@ class CleanupTool: storage_name = STORAGE_TYPES[choice] + # Special warning for JsonKVStorage about concurrent access + if storage_name == "JsonKVStorage": + print("\n" + "=" * 60) + print(f"{BOLD_RED}⚠️ IMPORTANT WARNING - JsonKVStorage Concurrency{RESET}") + print("=" * 60) + print("\nJsonKVStorage is an in-memory database that does NOT support") + print("concurrent access to the same file by multiple programs.") + print("\nBefore proceeding, please ensure that:") + print(" • LightRAG Server is completely shut down") + print(" • No other programs are accessing the storage files") + print("\n" + "=" * 60) + + confirm = ( + input("\nHas LightRAG Server been shut down? (yes/no): ") + .strip() + .lower() + ) + if confirm != "yes": + print( + "\n✓ Operation cancelled - Please shut down LightRAG Server first" + ) + return None, None, None + + print("✓ Proceeding with JsonKVStorage cleanup...") + # Check configuration (warnings only, doesn't block) print("\nChecking configuration...") self.check_env_vars(storage_name)