Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Queue<DataType, ReturnType, NameType>

Type parameters

  • DataType = any

  • ReturnType = any

  • NameType: string = string

Hierarchy

  • Queue<DataType, ReturnType, NameType>
    • Queue

Index

Constructors

  • new Queue<DataType, ReturnType, NameType>(name: string, opts?: QueueProOptions): Queue<DataType, ReturnType, NameType>
  • Type parameters

    • DataType = any

    • ReturnType = any

    • NameType: string = string

    Parameters

    Returns Queue<DataType, ReturnType, NameType>

Methods

  • add(name: NameType, data: DataType, opts?: JobsProOptions): Promise<Job<DataType, ReturnType, NameType>>
  • Adds a Job to the queue.

    Parameters

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

  • addBulk(jobs: { data: DataType; name: NameType; opts?: BulkJobProOptions }[]): Promise<Job<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<Job<DataType, ReturnType, NameType>[]>

  • deleteGroup(groupId: string | number): Promise<void>
  • Cleans all the jobs that are part of a group.

    Parameters

    • groupId: string | number

    Returns Promise<void>

  • deleteGroups(): Promise<void>
  • getGroupJobs(groupId: string | number, start?: number, end?: number): Promise<Job<DataType, ReturnType, NameType>[]>
  • Get jobs that are part of a given group.

    Parameters

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

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

  • getGroupJobsCount(groupId: string | number): Promise<number>
  • Gets the count of jobs inside a given group id.

    Parameters

    • groupId: string | number

    Returns Promise<number>

  • getGroups(start?: number, end?: number): Promise<{ id: string; status: GroupStatus }[]>
  • 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 }[]>

  • getGroupsCount(): Promise<number>
  • getGroupsJobsCount(): Promise<number>
  • obliterate(opts?: { count?: number; force?: boolean }): Promise<void>
  • Parameters

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

    Returns Promise<void>

  • pauseGroup(groupId: string | number): Promise<boolean>
  • 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>

  • resumeGroup(groupId: string | number): 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>

Generated using TypeDoc