Skip to content

JobStatus

const JobStatus: object;

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

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 non-retryable failure or 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 failed without automatic retries, either explicitly or after exhausting 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
}