Skip to content

Commit

Permalink
make sure to enter a transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
jakekaplan committed Jul 24, 2024
1 parent d59dd3b commit 26e74d5
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/prefect/server/services/task_run_recorder.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,9 @@ async def record_task_run_event(event: ReceivedEvent, depth: int = 0):
"state_name": task_run.state.name,
"state_timestamp": task_run.state.timestamp,
}
session = await stack.enter_async_context(db.session_context())
session = await stack.enter_async_context(
db.session_context(begin_transaction=True)
)

await _insert_task_run(session, task_run, task_run_attributes)
await _insert_task_run_state(session, task_run)
Expand Down

0 comments on commit 26e74d5

Please sign in to comment.