From 772f981e7e70af5d0ba49489eaee6e795d82cbd6 Mon Sep 17 00:00:00 2001 From: yangdx Date: Thu, 14 Aug 2025 12:35:39 +0800 Subject: [PATCH] fix: check and process queued docs even when upload directory is empty --- lightrag/api/routers/document_routes.py | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/lightrag/api/routers/document_routes.py b/lightrag/api/routers/document_routes.py index 924b642a..ffb085a3 100644 --- a/lightrag/api/routers/document_routes.py +++ b/lightrag/api/routers/document_routes.py @@ -1052,12 +1052,14 @@ async def run_scanning_process( total_files = len(new_files) logger.info(f"Found {total_files} files to index.") - if not new_files: - return - - # Process all files at once with track_id - await pipeline_index_files(rag, new_files, track_id) - logger.info(f"Scanning process completed: {total_files} files Processed.") + if new_files: + # Process all files at once with track_id + await pipeline_index_files(rag, new_files, track_id) + logger.info(f"Scanning process completed: {total_files} files Processed.") + else: + # No new files to index, check if there are any documents in the queue + logger.info("No upload file found, check if there are any documents in the queue...") + await rag.apipeline_process_enqueue_documents() except Exception as e: logger.error(f"Error during scanning process: {str(e)}")