UNPKG

@sidequest/core

Version:

@sidequest/core is the core package of SideQuest, a distributed background job queue for Node.js and TypeScript applications.

27 lines (24 loc) 884 B
import { ErrorData } from '../schema/error-data.js'; import { JobData } from '../schema/job-data.js'; import { JobTransition } from './transition.js'; /** * Transition for marking a job as failed. * * This transition sets the job state to "failed" and records the * failure reason and timestamp. It also stores the error data in the job's errors array. * Failed jobs will not be retried or processed again. * * This transition can only be applied to jobs that are currently running. */ declare class FailTransition extends JobTransition { /** The reason for failure. */ reason: ErrorData | Error | string; /** * Creates a new FailTransition. * @param reason The reason for the job failure. */ constructor(reason: ErrorData | Error | string); apply(job: JobData): JobData; shouldRun(job: JobData): boolean; } export { FailTransition };