From 27500191b40f0cb9b31f3ebb721a7545936c89ff Mon Sep 17 00:00:00 2001 From: yangdx Date: Thu, 27 Feb 2025 19:08:36 +0800 Subject: [PATCH] Standarize scan progress namespace initialization --- lightrag/lightrag.py | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/lightrag/lightrag.py b/lightrag/lightrag.py index ae250bac..0011fb6f 100644 --- a/lightrag/lightrag.py +++ b/lightrag/lightrag.py @@ -278,19 +278,18 @@ class LightRAG: ) initialize_share_data() - need_init = try_initialize_namespace("scan_progress") scan_progress = get_namespace_data("scan_progress") - logger.info(f"scan_progress type after init: {type(scan_progress)}") - scan_progress.update( - { - "is_scanning": False, - "current_file": "", - "indexed_count": 0, - "total_files": 0, - "progress": 0, - } - ) + if need_init: + scan_progress.update( + { + "is_scanning": False, + "current_file": "", + "indexed_count": 0, + "total_files": 0, + "progress": 0, + } + ) if not os.path.exists(self.working_dir): logger.info(f"Creating working directory {self.working_dir}")