diff --git a/api/services/retention/workflow_run/archive_paid_plan_workflow_run.py b/api/services/retention/workflow_run/archive_paid_plan_workflow_run.py index 243e93bf43..b08122c99d 100644 --- a/api/services/retention/workflow_run/archive_paid_plan_workflow_run.py +++ b/api/services/retention/workflow_run/archive_paid_plan_workflow_run.py @@ -508,17 +508,8 @@ class WorkflowRunArchiver: return trigger_repo.delete_by_run_ids(run_ids) def _delete_node_executions(self, session: Session, runs: Sequence[WorkflowRun]) -> tuple[int, int]: - run_contexts: list[DifyAPISQLAlchemyWorkflowNodeExecutionRepository.RunContext] = [ - { - "run_id": run.id, - "tenant_id": run.tenant_id, - "app_id": run.app_id, - "workflow_id": run.workflow_id, - "triggered_from": run.triggered_from, - } - for run in runs - ] - return DifyAPISQLAlchemyWorkflowNodeExecutionRepository.delete_by_runs(session, run_contexts) + run_ids = [run.id for run in runs] + return DifyAPISQLAlchemyWorkflowNodeExecutionRepository.delete_by_runs(session, run_ids) def _get_workflow_run_repo(self) -> APIWorkflowRunRepository: if self.workflow_run_repo is not None: diff --git a/api/services/retention/workflow_run/delete_archived_workflow_run.py b/api/services/retention/workflow_run/delete_archived_workflow_run.py index 4669c1d583..6709fa862d 100644 --- a/api/services/retention/workflow_run/delete_archived_workflow_run.py +++ b/api/services/retention/workflow_run/delete_archived_workflow_run.py @@ -117,17 +117,8 @@ class ArchivedWorkflowRunDeletion: session: Session, runs: Sequence[WorkflowRun], ) -> tuple[int, int]: - run_contexts: list[DifyAPISQLAlchemyWorkflowNodeExecutionRepository.RunContext] = [ - { - "run_id": run.id, - "tenant_id": run.tenant_id, - "app_id": run.app_id, - "workflow_id": run.workflow_id, - "triggered_from": run.triggered_from, - } - for run in runs - ] - return DifyAPISQLAlchemyWorkflowNodeExecutionRepository.delete_by_runs(session, run_contexts) + run_ids = [run.id for run in runs] + return DifyAPISQLAlchemyWorkflowNodeExecutionRepository.delete_by_runs(session, run_ids) def _get_workflow_run_repo(self) -> APIWorkflowRunRepository: if self.workflow_run_repo is not None: