From e2e5e0e22e1a4903aad00fafda6e1a634a4506ab Mon Sep 17 00:00:00 2001 From: root Date: Tue, 29 Oct 2024 14:28:57 +0800 Subject: [PATCH] Submitting tasks in a loop --- api/services/dataset_service.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/api/services/dataset_service.py b/api/services/dataset_service.py index 414ef0224a..0de810f25a 100644 --- a/api/services/dataset_service.py +++ b/api/services/dataset_service.py @@ -916,10 +916,12 @@ class DocumentService: db.session.commit() # trigger async task - if document_ids: - document_indexing_task.delay(dataset.id, document_ids) - if duplicate_document_ids: - duplicate_document_indexing_task.delay(dataset.id, duplicate_document_ids) + if document_ids: + for dociment_id in document_ids: + document_indexing_task.delay(dataset.id, [dociment_id]) + if duplicate_document_ids: + for duplicate_document_id in duplicate_document_ids: + duplicate_document_indexing_task.delay(dataset.id, [duplicate_document_id]) return documents, batch