Class QueuePro<DataType, ReturnType, NameType>

Type Parameters

  • DataType = any
  • ReturnType = any
  • NameType extends string = string

Hierarchy (view full)

  • Queue<DataType, ReturnType, NameType>
    • QueuePro

Constructors

Methods

  • Adds a Job to the queue.

    Parameters

    Returns Promise<JobPro<DataType, ReturnType, NameType>>

  • Adds an array of jobs to the queue. This method may be faster than adding one job at a time in a sequence.

    Parameters

    • jobs: {
          data: DataType;
          name: NameType;
          opts?: BulkJobProOptions;
      }[]

      The array of jobs to add to the queue. Each job is defined by 3 properties, 'name', 'data' and 'opts'. They follow the same signature as 'Queue.add'.

    Returns Promise<JobPro<DataType, ReturnType, NameType>[]>

  • Cleans all the jobs that are part of a group.

    Parameters

    • groupId: string | number

    Returns Promise<void>

  • Cleans all the groups in this queue

    Returns Promise<void>

  • Get jobs that are part of a given group.

    Parameters

    • groupId: string | number
    • start: number = 0
    • end: number = -1

    Returns Promise<JobPro<DataType, ReturnType, NameType>[]>

  • Gets the count of jobs inside a given group id.

    Parameters

    • groupId: string | number

    Returns Promise<number>

  • Get the group ids with jobs current jobs in them.

    TODO: Support group id filtering.

    Parameters

    • start: number = 0
    • end: number = -1

    Returns Promise<{
        id: string;
        status: GroupStatus;
    }[]>

  • Gets all the groups that are in a particular status.

    Parameters

    • status: GroupStatus

      GroupStatus so we can filter by status

    • start: number = 0

      start index, used for pagination.

    • end: number = -1

      end index, used for pagination.

    Returns Promise<{
        count: number;
        id: string;
    }[]>

    an array of objects with the group id and status.

  • Get the total number of groups with jobs in them.

    Returns Promise<number>

  • Get the total number of groups with jobs in them, in their different statuses.

    Returns Promise<{
        limited: number;
        maxed: number;
        paused: number;
        waiting: number;
    }>

  • Gets the count of all the jobs belonging to any group.

    Returns Promise<number>

  • Get the given group status.

    Parameters

    • groupId: string

      The group id to get the status for.

    Returns Promise<GroupStatus>

    GroupStatus - The status of the group or null if the group does not exist.

  • Get library version.

    Returns Promise<string>

    the content of the meta.library field.

  • Completely destroys the queue and all of its contents irreversibly. This method will the pause the queue and requires that there are no active jobs. It is possible to bypass this requirement, i.e. not having active jobs using the "force" option.

    Note: This operation requires to iterate on all the jobs stored in the queue and can be slow for very large queues.

    Parameters

    • Optional opts: {
          count?: number;
          force?: boolean;
      }

      Obliterate options.

      • Optional count?: number
      • Optional force?: boolean

    Returns Promise<void>

  • Pauses the processing of a specific group globally.

    Adding jobs requires a LUA script to check first if the paused list exist and in that case it will add it there instead of the wait list or group list.

    Parameters

    • groupId: string | number

    Returns Promise<boolean>

  • Resumes the processing of a specific group globally.

    The method reverses the pause operation by resuming the processing of the group.

    Parameters

    • groupId: string | number

    Returns Promise<boolean>