mirror of
https://github.com/dograh-hq/dograh.git
synced 2026-06-22 08:38:13 +02:00
fix: add lock in workflow run update, refactor _handle_stasis_start
This commit is contained in:
parent
f3b4de9eb6
commit
fe80c11ae5
2 changed files with 14 additions and 15 deletions
|
|
@ -321,8 +321,11 @@ class WorkflowRunClient(BaseDBClient):
|
|||
state: str | None = None,
|
||||
) -> WorkflowRunModel:
|
||||
async with self.async_session() as session:
|
||||
# Use SELECT FOR UPDATE to lock the row during the update
|
||||
result = await session.execute(
|
||||
select(WorkflowRunModel).where(WorkflowRunModel.id == run_id)
|
||||
select(WorkflowRunModel)
|
||||
.where(WorkflowRunModel.id == run_id)
|
||||
.with_for_update()
|
||||
)
|
||||
run = result.scalars().first()
|
||||
if not run:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue