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.
Python agentagentic-aiagentic-frameworkagentic-workflowaiautomationclaudedeepseekgenaigptllmlow-codemcpnextjsno-codeopenaipythonskillsworkflow
fix: batch delete document db session block (#32062)
Jyong4430a1b3da49
diff --git a/api/services/dataset_service.py b/api/services/dataset_service.pyindex 1ea6c4e1c3e..b208e394b0e 100644--- a/api/services/dataset_service.py+++ b/api/services/dataset_service.py@@ -1696,13 +1696,18 @@ class DocumentService:for document in documentsif document.data_source_type == "upload_file" and document.data_source_info_dict]- if dataset.doc_form is not None:- batch_clean_document_task.delay(document_ids, dataset.id, dataset.doc_form, file_ids)+ # Delete documents first, then dispatch cleanup task after commit+ # to avoid deadlock between main transaction and async taskfor document in documents:db.session.delete(document)db.session.commit()+ # Dispatch cleanup task after commit to avoid lock contention+ # Task cleans up segments, files, and vector indexes+ if dataset.doc_form is not None:+ batch_clean_document_task.delay(document_ids, dataset.id, dataset.doc_form, file_ids)+@staticmethoddef rename_document(dataset_id: str, document_id: str, name: str) -> Document:assert isinstance(current_user, Account)