types
BackoffStrategy
Defines the backoff strategy used when retrying failed jobs. Returns the delay in ms that should pass before the failed job is retried.
Signature
type BackoffStrategy = (queueName: string, attemptsMade: number, job: Job) => number
JobUpdate
Job update status as returned from the SubscribableJob’s update()
method.
Signature
type JobUpdate<T extends JobData<T>> = Pick<
Job<T>,
'id' | 'state' | 'progress' | 'result' | 'error' | 'data'
>
JobUpdateOptions
Job update options, that you can specify by calling {@link SubscribableJob.updates updates()} method.
Signature
type JobUpdateOptions = {
pollInterval?: number;
timeoutMs?: number;
errorOnFail?: boolean;
}
Members
pollInterval
property
type:
number
timeoutMs
property
type:
number
errorOnFail
property
type:
boolean
CreateQueueOptions
Used to configure a new JobQueue instance.
Signature
interface CreateQueueOptions<T extends JobData<T>> {
name: string;
process: (job: Job<T>) => Promise<any>;
}
Members
name
property
type:
string
The name of the queue, e.g. “image processing”, “re-indexing” etc.
process
property
type:
(job: Job<T>) => Promise<any>
Defines the work to be done for each job in the queue. The returned promise
should resolve when the job is complete, or be rejected in case of an error.
JobData
A JSON-serializable data type which provides a Jobwith the data it needs to be processed.
Signature
type JobData<T> = JsonCompatible<T>
JobConfig
Used to instantiate a new Job
Signature
interface JobConfig<T extends JobData<T>> {
queueName: string;
data: T;
retries?: number;
attempts?: number;
id?: ID;
state?: JobState;
progress?: number;
result?: any;
error?: any;
createdAt?: Date;
startedAt?: Date;
settledAt?: Date;
}
Members
queueName
property
type:
string
data
property
type:
T
retries
property
type:
number
attempts
property
type:
number
id
property
type:
ID
state
property
type:
JobState
progress
property
type:
number
result
property
type:
any
error
property
type:
any
createdAt
property
type:
Date
startedAt
property
type:
Date
settledAt
property
type:
Date