fix: Prevent session expiration on commit

Sets 'expire_on_commit' to False when creating a session to
ensure that objects remain accessible after a commit. This
change prevents potential issues with object expiration,
improving reliability when accessing session data after
committing transactions.

Signed-off-by: -LAN- <laipz8200@outlook.com>
pull/19430/head
-LAN- 1 year ago
parent 809cde6482
commit 3fa11c9bba
No known key found for this signature in database
GPG Key ID: 6BA0D108DED011FF

@ -192,7 +192,7 @@ def _delete_app_workflow_runs(tenant_id: str, app_id: str):
def _delete_app_workflow_node_executions(tenant_id: str, app_id: str):
# Get app's owner
with Session(db.engine) as session:
with Session(db.engine, expire_on_commit=False) as session:
stmt = select(Account).where(Account.id == App.owner_id).where(App.id == app_id)
user = session.scalar(stmt)

Loading…
Cancel
Save