fix: Add ON CONFLICT to workflow_executions insert
Prevents duplicate key violation when save_execution_state is called multiple times with the same execution_id (e.g., during error handling). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
c95b4e185d
commit
6016eec250
|
|
@ -880,6 +880,11 @@ def save_execution_state(
|
||||||
INSERT INTO workflow_executions
|
INSERT INTO workflow_executions
|
||||||
(id, workflow_id, profile_id, status, node_states, execution_log, started_at, completed_at)
|
(id, workflow_id, profile_id, status, node_states, execution_log, started_at, completed_at)
|
||||||
VALUES (%s, %s, %s, %s, %s, %s, %s, %s)
|
VALUES (%s, %s, %s, %s, %s, %s, %s, %s)
|
||||||
|
ON CONFLICT (id) DO UPDATE SET
|
||||||
|
status = EXCLUDED.status,
|
||||||
|
node_states = EXCLUDED.node_states,
|
||||||
|
execution_log = EXCLUDED.execution_log,
|
||||||
|
completed_at = EXCLUDED.completed_at
|
||||||
""", (
|
""", (
|
||||||
execution_id,
|
execution_id,
|
||||||
workflow_id,
|
workflow_id,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user