RAGFlow is an agent-native database: a Retrieval-Augmented Generation (RAG) engine that grew into context infrastructure.
Go agent-harnessagent-native-databaseagentic-aiagentic-retrievalagentic-searchaiai-agentscontext-enginecontext-engineeringcontext-managementharness-engineeringknowledge-compilationragretrieval-augmented-generationretrieval-harnesssearch-harness
Fix pdf cancel at task level not document level, multiple record logs (#18435)
Wang Qib5ad30ed432f
diff --git a/api/db/services/pipeline_operation_log_service.py b/api/db/services/pipeline_operation_log_service.pyindex 00806df5ce..14095d5886 100644--- a/api/db/services/pipeline_operation_log_service.py+++ b/api/db/services/pipeline_operation_log_service.py@@ -234,6 +234,38 @@ class PipelineOperationLogService(CommonService):log["update_time"] = timestamplog["update_date"] = datetime_nowwith DB.atomic():+ operation_status_value = operation_status.value if isinstance(operation_status, TaskStatus) else str(operation_status)+ if document_id != GRAPH_RAPTOR_FAKE_DOC_ID and operation_status_value == TaskStatus.CANCEL.value:+ # Serialize page-task finalizers for the same canceled document.+ locked_document = Document.select(Document.id, Document.run, Document.update_time).where(Document.id == document.id).for_update().first()+ if locked_document is None or locked_document.run != TaskStatus.CANCEL.value:+ return None+ cancel_update_time = locked_document.update_time or timestamp+ if locked_document.update_time is None:+ Document.update(update_time=cancel_update_time, update_date=datetime_now).where(Document.id == locked_document.id).execute()+ pipeline_filter = cls.model.pipeline_id == pipeline_id if pipeline_id else (cls.model.pipeline_id.is_null(True) | (cls.model.pipeline_id == ""))+ existing = (+ cls.model.select()+ .where(+ (cls.model.document_id == document_id)+ & pipeline_filter+ & (cls.model.task_type == task_type)+ & (cls.model.operation_status == TaskStatus.CANCEL.value)+ & (cls.model.create_time >= cancel_update_time)+ )+ .first()+ )+ if existing:+ logging.debug(+ "Skip duplicate pipeline operation log document_id=%s pipeline_id=%s task_type=%s process_begin_at=%s existing_id=%s",+ document_id,+ pipeline_id,+ task_type,+ process_begin_at,+ existing.id,+ )+ return existing+obj = cls.save(**log)limit = int(os.getenv("PIPELINE_OPERATION_LOG_LIMIT", 1000))