Options
All
  • Public
  • Public/Protected
  • All
Menu

Class JobProcessingQueue

Hierarchy

  • JobProcessingQueue

Index

Constructors

constructor

Properties

Private _queue

_queue: Job[]

Private agenda

agenda: Agenda

Accessors

length

  • get length(): number

Methods

getQueue

  • getQueue(): Job[]

insert

  • insert(job: Job): void
  • Inserts job in queue where it will be order from left to right in decreasing order of nextRunAt and priority (in case of same nextRunAt), if all values are even the first jobs to be introduced will have priority

    Parameters

    • job: Job

      job to add to queue

    Returns void

pop

  • pop(): Job | undefined
  • Pops and returns last queue element (next job to be processed) without checking concurrency.

    Returns Job | undefined

    Next Job to be processed

remove

  • remove(job: Job): void

returnNextConcurrencyFreeJob

  • returnNextConcurrencyFreeJob(jobStatus: {}, handledJobs: IJobParameters["_id"][]): (JobWithId & { attrs: IJobParameters & { nextRunAt: Date } }) | undefined
  • Returns (does not pop, element remains in queue) first element (always from the right) that can be processed (not blocked by concurrency execution)

    Parameters

    • jobStatus: {}

      current status of jobs

      • [jobName: string]: { running: number } | undefined
    • handledJobs: IJobParameters["_id"][]

    Returns (JobWithId & { attrs: IJobParameters & { nextRunAt: Date } }) | undefined

    Next Job to be processed

Generated using TypeDoc