Skip to content

isCompletedJob

function isCompletedJob<T>(job): boolean;

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

Type guard to check if a job has completed successfully.

A convenience helper for checking if a job finished without errors. Equivalent to job.status === JobStatus.COMPLETED 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 'completed'

const jobs = await monque.getJobs();
const completedJobs = jobs.filter(isCompletedJob);
console.log(`${completedJobs.length} jobs completed successfully`);