Skip to content

JobStatus

const JobStatus: object;

Defined in: packages/core/src/jobs/types.ts:20

Represents the lifecycle states of a job in the queue.

Jobs transition through states as follows:

  • PENDING → PROCESSING (when picked up by a worker)
  • PROCESSING → COMPLETED (on success)
  • PROCESSING → PENDING (on failure, if retries remain)
  • PROCESSING → FAILED (on failure, after max retries exhausted)
  • PENDING → CANCELLED (on manual cancellation)
readonly CANCELLED: "cancelled" = 'cancelled';

Job was manually cancelled

readonly COMPLETED: "completed" = 'completed';

Job completed successfully

readonly FAILED: "failed" = 'failed';

Job permanently failed after exhausting all retry attempts

readonly PENDING: "pending" = 'pending';

Job is waiting to be picked up by a worker

readonly PROCESSING: "processing" = 'processing';

Job is currently being executed by a worker

if (job.status === JobStatus.PENDING) {
  // job is waiting to be picked up
}