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) 835 B
import { JobData } from '../schema/job-data.js'; import { JobTransition } from './transition.js'; /** * Transition for snoozing (delaying) a job. * * This transition sets the job state to "waiting" and updates the * available_at timestamp to the current time plus the specified delay. * If the job is currently running, it will decrement the attempt count. * This allows the job to be retried after the delay. * * Only jobs in "waiting" or "running" state can be snoozed. */ declare class SnoozeTransition extends JobTransition { /** The delay in milliseconds. */ delay: number; /** * Creates a new SnoozeTransition. * @param delay The delay in milliseconds. */ constructor(delay: number); apply(job: JobData): JobData; shouldRun(job: JobData): boolean; } export { SnoozeTransition };