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

Function fireClock

packages/infra/src/WorkflowEngineCosmos.ts:455–468  ·  view source on GitHub ↗
(doc: ClockDoc)

Source from the content-addressed store, hash-verified

453 // Persist deferred completion (first-writer-wins via createIfMissing),
454 // resume the workflow, then clean up the clock doc.
455 const fireClock = (doc: ClockDoc): Effect.Effect<void> =>
456 Effect.gen(function*() {
457 const created = yield* createIfMissing<DeferredDoc>({
458 id: deferredKey(doc.deferredName),
459 _partitionKey: doc._partitionKey,
460 type: "deferred",
461 exit: yield* encodeDeferredExit(Exit.void)
462 })
463 .pipe(annotate("clockFire", doc._partitionKey))
464 if (created) yield* driveById(doc._partitionKey)
465 yield* Effect.promise(() => container.item(doc.id, doc._partitionKey).delete()).pipe(
466 Effect.catchCause(() => Effect.void)
467 )
468 })
469
470 // Persist `interrupted: true`, retrying on OCC. A suspending driver's
471 // onComplete (or a heartbeat renewal) can win the etag race; silently

Callers 1

Calls 7

createIfMissingFunction · 0.85
deferredKeyFunction · 0.85
itemMethod · 0.80
encodeDeferredExitFunction · 0.70
annotateFunction · 0.70
driveByIdFunction · 0.70
pipeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…