Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Scheduler

Hierarchy

  • EventEmitter
    • Scheduler

Index

Constructors

constructor

  • new Scheduler(options: any, jobs?: {}): Scheduler

Properties

connection

connection: Connection

jobs

jobs: Jobs

leader

leader: boolean

name

name: string

options

options: SchedulerOptions

processing

processing: boolean

queue

queue: Queue

running

running: boolean

timer

timer: Timeout

Static Readonly captureRejectionSymbol

captureRejectionSymbol: typeof captureRejectionSymbol

Static captureRejections

captureRejections: boolean

Sets or gets the default captureRejection value for all emitters.

Static defaultMaxListeners

defaultMaxListeners: number

Static Readonly errorMonitor

errorMonitor: typeof errorMonitor

This symbol shall be used to install a listener for only monitoring 'error' events. Listeners installed using this symbol are called before the regular 'error' listeners are called.

Installing a listener using this symbol does not change the behavior once an 'error' event is emitted, therefore the process will still crash if no regular 'error' listener is installed.

Methods

addListener

  • addListener(event: string | symbol, listener: (...args: any[]) => void): Scheduler
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Scheduler

Private canWatch

  • canWatch(): boolean

Private checkStuckWorkers

  • checkStuckWorkers(): Promise<void>

Private cleanupTimestamp

  • cleanupTimestamp(timestamp: number): Promise<void>

connect

  • connect(): Promise<void>

emit

  • emit(event: string | symbol, ...args: any[]): boolean
  • Parameters

    • event: string | symbol
    • Rest ...args: any[]

    Returns boolean

end

  • end(): Promise<unknown>

Private enqueueDelayedItemsForTimestamp

  • enqueueDelayedItemsForTimestamp(timestamp: number): Promise<void>

eventNames

  • eventNames(): (string | symbol)[]
  • Returns (string | symbol)[]

forceCleanWorker

  • forceCleanWorker(workerName: any, delta: any): Promise<void>

getMaxListeners

  • getMaxListeners(): number
  • Returns number

listenerCount

  • listenerCount(event: string | symbol): number
  • Parameters

    • event: string | symbol

    Returns number

listeners

  • listeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

Private nextDelayedTimestamp

  • nextDelayedTimestamp(): Promise<string>

Private nextItemForTimestamp

  • nextItemForTimestamp(timestamp: number): Promise<any>

off

  • off(event: string | symbol, listener: (...args: any[]) => void): Scheduler
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Scheduler

on

  • on(event: "start" | "end" | "poll" | "leader", cb: () => void): Scheduler
  • on(event: "cleanStuckWorker", cb: (workerName: string, errorPayload: ErrorPayload, delta: number) => void): Scheduler
  • on(event: "error", cb: (error: Error, queue: string) => void): Scheduler
  • on(event: "workingTimestamp", cb: (timestamp: number) => void): Scheduler
  • on(event: "transferredJob", cb: (timestamp: number, job: Job<any>) => void): Scheduler
  • Parameters

    • event: "start" | "end" | "poll" | "leader"
    • cb: () => void
        • (): void
        • Returns void

    Returns Scheduler

  • Parameters

    • event: "cleanStuckWorker"
    • cb: (workerName: string, errorPayload: ErrorPayload, delta: number) => void
        • (workerName: string, errorPayload: ErrorPayload, delta: number): void
        • Parameters

          • workerName: string
          • errorPayload: ErrorPayload
          • delta: number

          Returns void

    Returns Scheduler

  • Parameters

    • event: "error"
    • cb: (error: Error, queue: string) => void
        • (error: Error, queue: string): void
        • Parameters

          • error: Error
          • queue: string

          Returns void

    Returns Scheduler

  • Parameters

    • event: "workingTimestamp"
    • cb: (timestamp: number) => void
        • (timestamp: number): void
        • Parameters

          • timestamp: number

          Returns void

    Returns Scheduler

  • Parameters

    • event: "transferredJob"
    • cb: (timestamp: number, job: Job<any>) => void
        • (timestamp: number, job: Job<any>): void
        • Parameters

          • timestamp: number
          • job: Job<any>

          Returns void

    Returns Scheduler

once

  • once(event: "start" | "end" | "poll" | "leader", cb: () => void): Scheduler
  • once(event: "cleanStuckWorker", cb: (workerName: string, errorPayload: ErrorPayload, delta: number) => void): Scheduler
  • once(event: "error", cb: (error: Error, queue: string) => void): Scheduler
  • once(event: "workingTimestamp", cb: (timestamp: number) => void): Scheduler
  • once(event: "transferredJob", cb: (timestamp: number, job: Job<any>) => void): Scheduler
  • Parameters

    • event: "start" | "end" | "poll" | "leader"
    • cb: () => void
        • (): void
        • Returns void

    Returns Scheduler

  • Parameters

    • event: "cleanStuckWorker"
    • cb: (workerName: string, errorPayload: ErrorPayload, delta: number) => void
        • (workerName: string, errorPayload: ErrorPayload, delta: number): void
        • Parameters

          • workerName: string
          • errorPayload: ErrorPayload
          • delta: number

          Returns void

    Returns Scheduler

  • Parameters

    • event: "error"
    • cb: (error: Error, queue: string) => void
        • (error: Error, queue: string): void
        • Parameters

          • error: Error
          • queue: string

          Returns void

    Returns Scheduler

  • Parameters

    • event: "workingTimestamp"
    • cb: (timestamp: number) => void
        • (timestamp: number): void
        • Parameters

          • timestamp: number

          Returns void

    Returns Scheduler

  • Parameters

    • event: "transferredJob"
    • cb: (timestamp: number, job: Job<any>) => void
        • (timestamp: number, job: Job<any>): void
        • Parameters

          • timestamp: number
          • job: Job<any>

          Returns void

    Returns Scheduler

poll

  • poll(): any

Private pollAgainLater

  • pollAgainLater(): Promise<void>

prependListener

  • prependListener(event: string | symbol, listener: (...args: any[]) => void): Scheduler
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Scheduler

prependOnceListener

  • prependOnceListener(event: string | symbol, listener: (...args: any[]) => void): Scheduler
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Scheduler

rawListeners

  • rawListeners(event: string | symbol): Function[]
  • Parameters

    • event: string | symbol

    Returns Function[]

Private releaseLeaderLock

  • releaseLeaderLock(): Promise<boolean>

removeAllListeners

  • removeAllListeners(event: SchedulerEvent): Scheduler

removeListener

  • removeListener(event: string | symbol, listener: (...args: any[]) => void): Scheduler
  • Parameters

    • event: string | symbol
    • listener: (...args: any[]) => void
        • (...args: any[]): void
        • Parameters

          • Rest ...args: any[]

          Returns void

    Returns Scheduler

setMaxListeners

  • Parameters

    • n: number

    Returns Scheduler

start

  • start(): Promise<void>

Private transfer

  • transfer(timestamp: number, job: any): Promise<void>

Private tryForLeader

  • tryForLeader(): Promise<boolean>

Private unwatchIfPossible

  • unwatchIfPossible(): Promise<string>

Private watchIfPossible

  • watchIfPossible(key: string): Promise<"OK">

Static listenerCount

  • listenerCount(emitter: EventEmitter, event: string | symbol): number
  • deprecated

    since v4.0.0

    Parameters

    • emitter: EventEmitter
    • event: string | symbol

    Returns number

Static on

  • on(emitter: EventEmitter, event: string, options?: StaticEventEmitterOptions): AsyncIterableIterator<any>
  • Parameters

    • emitter: EventEmitter
    • event: string
    • Optional options: StaticEventEmitterOptions

    Returns AsyncIterableIterator<any>

Static once

  • once(emitter: NodeEventTarget, event: string | symbol, options?: StaticEventEmitterOptions): Promise<any[]>
  • once(emitter: DOMEventTarget, event: string, options?: StaticEventEmitterOptions): Promise<any[]>
  • Parameters

    • emitter: NodeEventTarget
    • event: string | symbol
    • Optional options: StaticEventEmitterOptions

    Returns Promise<any[]>

  • Parameters

    • emitter: DOMEventTarget
    • event: string
    • Optional options: StaticEventEmitterOptions

    Returns Promise<any[]>

Generated using TypeDoc