MCPcopy Create free account
hub / github.com/effect-app/libs / markInterrupted

Function markInterrupted

packages/infra/src/WorkflowEngineCosmos.ts:477–490  ·  view source on GitHub ↗
(executionId: string)

Source from the content-addressed store, hash-verified

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

Callers 1

Calls 4

readExecFunction · 0.70
replaceExecFunction · 0.70
pipeMethod · 0.65
succeedMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…