Skip to main content

Interface: JobAckFence

Defined in: packages/workflow-engine/src/persistence/interface.ts:591

Fencing token for a job acknowledgement.

A worker that stalls past the lease threshold has its job released by releaseStaleJobs and re-claimed by someone else. Without a fence the stalled worker's eventual complete() marks the new attempt COMPLETED and the work it is actually doing is thrown away. Conditioning the write on the attempt stamp the claim handed out (Oban's attempted_at predicate, one extra WHERE clause and no extra column) turns that write into a no-op instead.

Properties​

attempt​

attempt: number

Defined in: packages/workflow-engine/src/persistence/interface.ts:602

DequeueResult.attempt from the same claim. The stamp alone is the Oban predicate, but our timestamps are timestamp(3) — two claims landing in the same millisecond would share a stamp. attempt strictly increases on every claim, so the pair identifies exactly one attempt at any resolution. It costs one more term in the same WHERE clause and still no extra column.


startedAt​

startedAt: Date

Defined in: packages/workflow-engine/src/persistence/interface.ts:593

DequeueResult.startedAt from the claim being acknowledged.