UNPKG

adonis-resque

Version:
47 lines (46 loc) 2.17 kB
import { ResqueFailure } from "./types.js"; import { Plugin } from "node-resque"; export default class BaseJob { interval?: string | number; cron?: string; plugins: [typeof Plugin, any][]; delayMs: number; runAtMs?: number; /** * the default JobName is this class name * it **MUST be a unique name** */ jobName?: string; /** * set a queueName for this job * default configured in `config/resque.ts` */ queueName?: string; args: any[]; allArgs: any[][]; hasEnqueued: boolean; hasEnqueuedAll: boolean; app: import("@adonisjs/core/types").ApplicationService; constructor(..._args: any[]); queue(queueName: string): this; static enqueueAll<T extends typeof BaseJob>(this: T, args: Parameters<T['prototype']['perform']>[]): Promise<boolean | void | boolean[]>; enqueueAll<T extends BaseJob>(this: T, args: Parameters<T['perform']>[]): Promise<boolean | void | boolean[]>; perform(..._args: any[]): any; handleError(error: unknown): void; onFailure(_failure: ResqueFailure): void | Promise<void>; private execute; private push; static enqueue<T extends typeof BaseJob>(this: T, ...args: Parameters<InstanceType<T>['perform']>): Promise<boolean | void | boolean[]>; enqueue<T extends BaseJob>(this: T, ...args: Parameters<T['perform']>): Promise<boolean | void | boolean[]>; /** * * @param this * @param delayMs In ms, the number of ms to delay before this job is able to start being worked on * @param args * @returns */ static enqueueIn<T extends typeof BaseJob>(this: T, delayMs: number, ...args: Parameters<InstanceType<T>['perform']>): Promise<boolean | void | boolean[]>; enqueueIn<T extends BaseJob>(this: T, delayMs: number, ...args: Parameters<T['perform']>): Promise<boolean | void | boolean[]>; static enqueueAt<T extends typeof BaseJob>(this: T, runAtMs: number, ...args: Parameters<InstanceType<T>['perform']>): Promise<boolean | void | boolean[]>; enqueueAt<T extends BaseJob>(this: T, runAtMs: number, ...args: Parameters<T['perform']>): Promise<boolean | void | boolean[]>; }