refactor(remove_app_and_related_data_task): Remove 'expire_on_commit' to prevent session issues

Signed-off-by: -LAN- <laipz8200@outlook.com>
pull/21458/head
-LAN- 10 months ago
parent 00c50edfbd
commit 7a47b8621b
No known key found for this signature in database
GPG Key ID: 6BA0D108DED011FF

@ -192,7 +192,7 @@ def _delete_app_workflows(tenant_id: str, app_id: str):
def _delete_app_workflow_runs(tenant_id: str, app_id: str):
"""Delete all workflow runs for an app using the service repository."""
session_maker = sessionmaker(bind=db.engine, expire_on_commit=False)
session_maker = sessionmaker(bind=db.engine)
workflow_run_repo = DifyAPIRepositoryFactory.create_api_workflow_run_repository(session_maker)
deleted_count = workflow_run_repo.delete_runs_by_app(
@ -206,7 +206,7 @@ def _delete_app_workflow_runs(tenant_id: str, app_id: str):
def _delete_app_workflow_node_executions(tenant_id: str, app_id: str):
"""Delete all workflow node executions for an app using the service repository."""
session_maker = sessionmaker(bind=db.engine, expire_on_commit=False)
session_maker = sessionmaker(bind=db.engine)
node_execution_repo = DifyAPIRepositoryFactory.create_api_workflow_node_execution_repository(session_maker)
deleted_count = node_execution_repo.delete_executions_by_app(

Loading…
Cancel
Save