(executionId: string)
| 475 | // synchronous writes never interleave here — Cosmos round-trips open a real |
| 476 | // race window, so the write must converge rather than swallow the conflict. |
| 477 | const markInterrupted = (executionId: string): Effect.Effect<void> => |
| 478 | Effect.gen(function*() { |
| 479 | while (true) { |
| 480 | const current = yield* readExec(executionId) |
| 481 | if (Option.isNone(current) || current.value.status === "complete" || current.value.interrupted) { |
| 482 | return |
| 483 | } |
| 484 | const persisted = yield* replaceExec({ ...current.value, interrupted: true }).pipe( |
| 485 | Effect.as(true), |
| 486 | Effect.catchTag("OptimisticConcurrencyException", () => Effect.succeed(false)) |
| 487 | ) |
| 488 | if (persisted) return |
| 489 | } |
| 490 | }) |
| 491 | |
| 492 | // --- Encoded engine ---------------------------------------------------- |
| 493 |
no test coverage detected
searching dependent graphs…