Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Scripts

Hierarchy

  • Scripts

Index

Constructors

Methods

  • changeDelay(jobId: string, delay: number): Promise<void>
  • cleanJobsInSet(set: string, timestamp: number, limit?: number): Promise<string[]>
  • Remove jobs in a specific state.

    Parameters

    • set: string
    • timestamp: number
    • limit: number = 0

    Returns Promise<string[]>

    Id jobs from the deleted records.

  • drain(delayed: boolean): Promise<void>
  • extendLock(jobId: string, token: string, duration: number): Promise<number>
  • finishedErrors(code: number, jobId: string, command: string, state?: string): Error
  • Parameters

    • code: number
    • jobId: string
    • command: string
    • Optional state: string

    Returns Error

  • getState(jobId: string): Promise<JobState | "unknown">
  • isFinished(jobId: string, returnValue?: boolean): Promise<number | [number, string]>
  • Parameters

    • jobId: string
    • returnValue: boolean = false

    Returns Promise<number | [number, string]>

  • isJobInList(listKey: string, jobId: string): Promise<boolean>
  • moveStalledJobsToWait(): Promise<any>
  • Looks for unlocked jobs in the active queue.

    The job was being worked on, but the worker process died and it failed to renew the lock. We call these jobs 'stalled'. This is the most common case. We resolve these by moving them back to wait to be re-processed. To prevent jobs from cycling endlessly between active and wait, (e.g. if the job handler keeps crashing), we limit the number stalled job recoveries to settings.maxStalledCount.

    Returns Promise<any>

  • moveToActive<T, R, N>(token: string, jobId?: string): Promise<[] | [number | JobJsonRaw, string?]>
  • moveToCompleted<T, R, N>(job: Job<T, R, N>, returnvalue: R, removeOnComplete: number | boolean | KeepJobs, token: string, fetchNext: boolean): Promise<[] | JobData>
  • Type parameters

    • T = any

    • R = any

    • N: string = string

    Parameters

    • job: Job<T, R, N>
    • returnvalue: R
    • removeOnComplete: number | boolean | KeepJobs
    • token: string
    • fetchNext: boolean

    Returns Promise<[] | JobData>

  • moveToDelayed(jobId: string, timestamp: number, token?: string): Promise<void>
  • Parameters

    • jobId: string
    • timestamp: number
    • token: string = '0'

    Returns Promise<void>

  • moveToDelayedArgs(jobId: string, timestamp: number, token: string): string[]
  • moveToFailedArgs<T, R, N>(job: Job<T, R, N>, failedReason: string, removeOnFailed: number | boolean | KeepJobs, token: string, fetchNext?: boolean): (string | number | boolean | Buffer)[]
  • Type parameters

    • T = any

    • R = any

    • N: string = string

    Parameters

    • job: Job<T, R, N>
    • failedReason: string
    • removeOnFailed: number | boolean | KeepJobs
    • token: string
    • fetchNext: boolean = false

    Returns (string | number | boolean | Buffer)[]

  • Move parent job to waiting-children state.

    throws

    JobNotExist This exception is thrown if jobId is missing.

    throws

    JobLockNotExist This exception is thrown if job lock is missing.

    throws

    JobNotInState This exception is thrown if job is not in active state.

    Parameters

    Returns Promise<boolean>

    true if job is successfully moved, false if there are pending dependencies.

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

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

    Returns Promise<number>

  • pause(pause: boolean): Promise<void>
  • promote(jobId: string): Promise<number>
  • remove(jobId: string): Promise<number>
  • removeRepeatable(repeatJobId: string, repeatJobKey: string): Promise<number>
  • reprocessJob<T, R, N>(job: Job<T, R, N>, state: "completed" | "failed"): Promise<void>
  • Attempts to reprocess a job

    Type parameters

    • T = any

    • R = any

    • N: string = string

    Parameters

    • job: Job<T, R, N>
    • state: "completed" | "failed"

      The expected job state. If the job is not found on the provided state, then it's not reprocessed. Supported states: 'failed', 'completed'

    Returns Promise<void>

    Returns a promise that evaluates to a return code: 1 means the operation was a success 0 means the job does not exist -1 means the job is currently locked and can't be retried. -2 means the job was not found in the expected set

  • retryJobArgs<T, R, N>(job: Job<T, R, N>): string[]
  • retryJobs(state?: FinishedStatus, count?: number, timestamp?: number): Promise<number>
  • updateData<T, R, N>(job: Job<T, R, N>, data: T): Promise<void>
  • Type parameters

    • T = any

    • R = any

    • N: string = string

    Parameters

    • job: Job<T, R, N>
    • data: T

    Returns Promise<void>

  • updateDelaySet(delayedTimestamp: number): Promise<[number, string]>
  • It checks if the job in the top of the delay set should be moved back to the top of the wait queue (so that it will be processed as soon as possible)

    Parameters

    • delayedTimestamp: number

    Returns Promise<[number, string]>

  • updateProgress<T, R, N>(job: Job<T, R, N>, progress: number | object): Promise<void>
  • Type parameters

    • T = any

    • R = any

    • N: string = string

    Parameters

    • job: Job<T, R, N>
    • progress: number | object

    Returns Promise<void>

Generated using TypeDoc