Skip to content

isCancelledJob

function isCancelledJob<T>(job): boolean;

Defined in: packages/core/src/jobs/guards.ts:189

Type guard to check if a job has been manually cancelled.

A convenience helper for checking if a job was cancelled by an operator. Equivalent to job.status === JobStatus.CANCELLED but with better semantics.

Type ParameterDescription
TThe type of the job’s data payload
ParameterTypeDescription
jobJob<T>The job to check

boolean

true if the job status is 'cancelled'

const jobs = await monque.getJobs();
const cancelledJobs = jobs.filter(isCancelledJob);
console.log(`${cancelledJobs.length} jobs were cancelled`);