Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix: tolerate exceptions in cleaning up index when vector db service unavailable (#2533)

Bowen Liange42175241e36
diff --git a/api/tasks/remove_document_from_index_task.py b/api/tasks/remove_document_from_index_task.py
index 514712991cd..cff8dddc53c 100644
--- a/api/tasks/remove_document_from_index_task.py
+++ b/api/tasks/remove_document_from_index_task.py
@@ -42,7 +42,10 @@ def remove_document_from_index_task(document_id: str):
segments = db.session.query(DocumentSegment).filter(DocumentSegment.document_id == document.id).all()
index_node_ids = [segment.index_node_id for segment in segments]
if index_node_ids:
- index_processor.clean(dataset, index_node_ids)
+ try:
+ index_processor.clean(dataset, index_node_ids)
+ except Exception:
+ logging.exception(f"clean dataset {dataset.id} from index failed")
end_at = time.perf_counter()
logging.info(