Skip to content

five-on-it / apps/api/src/store / Job

Interface: Job ​

Defined in: apps/api/src/store.ts:263

A job of the platform's durable queue (queue.ts): saved before it is answered, claimed by one process at a time and held by a lease that process renews while it runs, so a job outlives the process that queued it and one whose process went away is taken up again (or failed, after its attempts). Its doc is what it needs to run, a snapshot taken when it was queued (a build's game and level spec as they were).

Properties ​

attempts ​

attempts: number

Defined in: apps/api/src/store.ts:283

How many times a process claimed it.


createdAt ​

createdAt: string

Defined in: apps/api/src/store.ts:287

ISO times.


doc ​

doc: Record<string, unknown>

Defined in: apps/api/src/store.ts:293

What it needs to run, as it was queued.


error? ​

optional error?: string

Defined in: apps/api/src/store.ts:291

Why it failed.


finishedAt? ​

optional finishedAt?: string

Defined in: apps/api/src/store.ts:289


id ​

id: string

Defined in: apps/api/src/store.ts:265

The build's own id for a build (build-…); job-… for the others.


kind ​

kind: JobKind

Defined in: apps/api/src/store.ts:267

What it does.


leaseUntil? ​

optional leaseUntil?: string

Defined in: apps/api/src/store.ts:285

ISO time the claim of the process running it holds until.


owner ​

owner: string

Defined in: apps/api/src/store.ts:269

The account it runs for.


parent? ​

optional parent?: string

Defined in: apps/api/src/store.ts:279

The job it runs for, when another job queued it.


priority ​

priority: number

Defined in: apps/api/src/store.ts:281

Higher goes first (0 by default).


startedAt? ​

optional startedAt?: string

Defined in: apps/api/src/store.ts:288


state ​

state: "done" | "failed" | "waiting" | "running" | "queued" | "cancelled"

Defined in: apps/api/src/store.ts:275

Where it stands: waiting its turn, held by a process, or over; a creation between the turns of its conversation is waiting (its model answered, nothing held) until its owner says more.


step? ​

optional step?: string

Defined in: apps/api/src/store.ts:277

What it is doing, in a few words, while it runs.