Skip to content

Commit 3a89556

Browse files
committed
docs(run-engine): explain why the SUSPENDED unblock path stays non-transactional
1 parent f9974dd commit 3a89556

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

internal-packages/run-engine/src/engine/systems/waitpointSystem.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -925,6 +925,11 @@ export class WaitpointSystem {
925925
waitpoints: blockingWaitpoints.map((w) => w.waitpoint),
926926
};
927927
}
928+
// Unlike EXECUTING_WITH_WAITPOINTS above, this case is deliberately NOT
929+
// wrapped in a single transaction: enqueueRun performs Redis queue work
930+
// internally, which must never run inside an open Postgres transaction.
931+
// Its snapshot insert and the post-switch waitpoint deletion below stay
932+
// separate statements, as they were before the transactional refactor.
928933
case "SUSPENDED": {
929934
if (!snapshot.checkpointId) {
930935
// A run canceled mid-suspend has its checkpoint cleared by the
@@ -980,6 +985,8 @@ export class WaitpointSystem {
980985
}
981986
}
982987

988+
// Only the SUSPENDED case reaches here — EXECUTING_WITH_WAITPOINTS returns
989+
// above after deleting its waitpoints inside its transaction.
983990
if (blockingWaitpoints.length > 0) {
984991
//5. Remove the blocking waitpoints
985992
await this.$.prisma.taskRunWaitpoint.deleteMany({

0 commit comments

Comments
 (0)