Class Job<DataType, ReturnType, NameType>

Type Parameters

  • DataType = any

  • ReturnType = any

  • NameType extends string = string

Hierarchy

  • Job<DataType, ReturnType, NameType>
    • Job

Constructors

  • Type Parameters

    • DataType = any

    • ReturnType = any

    • NameType extends string = string

    Parameters

    • queue: MinimalQueue
    • name: NameType

      The name of the Job

    • data: DataType

      The payload for this job.

    • opts: JobsProOptions = {}

      The options object for this job.

    • Optional id: string

    Returns Job<DataType, ReturnType, NameType>

Properties

gid: string | number
id?: string

Methods

  • Prepares a job to be passed to Sandbox.

    Returns

    Returns JobProJsonSandbox

  • Moves the job to the delay set.

    Returns

    Parameters

    • timestamp: number

      timestamp where the job should be moved back to "wait"

    • Optional token: string

      token to check job is locked by current worker

    Returns Promise<void>

  • Moves a job to the failed queue.

    Returns

    void

    Parameters

    • err: Error

      the jobs error message.

    • token: string

      token to check job is locked by current worker

    • fetchNext: boolean = false

      true when wanting to fetch the next job

    Returns Promise<void>

  • Moves the job to the waiting-children set.

    Returns

    true if the job was moved

    Parameters

    • token: string

      Token to check job is locked by current worker

    • opts: MoveToWaitingChildrenOpts = {}

      The options bag for moving a job to waiting-children.

    Returns Promise<boolean>

  • Instantiates a Job from a JobJsonRaw object (coming from a deserialized JSON object)

    Returns

    Type Parameters

    • T = any

    • R = any

    • N extends string = string

    Parameters

    • queue: MinimalQueue

      the queue where the job belongs to.

    • json: JobProJsonRaw

      the plain object containing the job.

    • Optional jobId: string

      an optional job id (overrides the id coming from the JSON object)

    Returns Job<T, R, N>

Generated using TypeDoc