Class Scripts

Constructors

Properties

moveToFinishedKeys: string[]

Methods

  • Parameters

    • jobId: string
    • logRow: string
    • Optional keepLogs: number

    Returns Promise<number>

  • Parameters

    Returns Promise<string>

  • Parameters

    • jobId: string
    • delay: number

    Returns Promise<void>

  • Parameters

    • jobId: string
    • priority: number = 0
    • lifo: boolean = false

    Returns Promise<void>

  • Remove jobs in a specific state.

    Parameters

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

    Returns Promise<string[]>

    Id jobs from the deleted records.

  • Parameters

    • client: ChainableCommander | RedisClient
    • commandName: string
    • args: any[]

    Returns any

  • Parameters

    • jobId: string
    • token: string
    • duration: number
    • Optional client: ChainableCommander | RedisClient

    Returns Promise<number>

  • Parameters

    • __namedParameters: {
          code: number;
          command: string;
          jobId?: string;
          parentKey?: string;
          state?: string;
      }
      • code: number
      • command: string
      • Optional jobId?: string
      • Optional parentKey?: string
      • Optional state?: string

    Returns Error

  • Parameters

    • priorities: number[]

    Returns Promise<number[]>

  • Parameters

    • types: JobType[]
    • start: number = 0
    • end: number = 1
    • asc: boolean = false

    Returns Promise<[string][]>

  • Parameters

    • Optional maxJobs: number

    Returns Promise<number>

  • Parameters

    • Optional maxJobs: number

    Returns (string | number)[]

  • Parameters

    • repeatConcatOptions: string
    • repeatJobKey: string

    Returns string

  • Parameters

    • jobId: string
    • returnValue: boolean = false

    Returns Promise<number | [number, string]>

  • Parameters

    • listKey: string
    • jobId: string

    Returns Promise<boolean>

  • Moves a job back from Active to Wait. This script is used when a job has been manually rate limited and needs to be moved back to wait from active status.

    Parameters

    • jobId: string

      Job id

    • token: string

    Returns 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<[string[], string[]]>

  • Type Parameters

    • T = any
    • R = any
    • N extends string = string

    Parameters

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

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

  • Parameters

    • jobId: string
    • timestamp: number
    • delay: number
    • token: string = '0'
    • opts: MoveToDelayedOpts = {}

    Returns Promise<void>

  • Parameters

    Returns (string | number)[]

  • Type Parameters

    • T = any
    • R = any
    • N extends string = string

    Parameters

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

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

  • Parameters

    • jobId: string
    • args: (string | number | boolean | Buffer)[]

    Returns Promise<any[]>

  • Move parent job to waiting-children state.

    Parameters

    Returns Promise<boolean>

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

    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

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

    Returns Promise<number>

  • Paginate a set or hash keys.

    Parameters

    • key: string
    • opts: {
          end: number;
          fetchJobs?: boolean;
          start: number;
      }
      • end: number
      • Optional fetchJobs?: boolean
      • start: number

    Returns Promise<{
        cursor: string;
        items: {
            err?: string;
            id: string;
            v?: any;
        }[];
        jobs?: JobJsonRaw[];
        total: number;
    }>

  • Parameters

    • count: number = 1000

    Returns Promise<number>

  • Parameters

    • jobId: string
    • removeChildren: boolean

    Returns Promise<number>

  • Parameters

    • jobId: string
    • parentKey: string

    Returns Promise<boolean>

  • Parameters

    • jobSchedulerId: string

    Returns Promise<number>

  • Parameters

    • legacyRepeatJobId: string
    • repeatConcatOptions: string
    • repeatJobKey: string

    Returns Promise<number>

  • Attempts to reprocess a job

    Type Parameters

    • T = any
    • R = any
    • N extends string = string

    Parameters

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

      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

  • Parameters

    • jobId: string
    • lifo: boolean
    • token: string

    Returns (string | number)[]

  • Parameters

    • state: FinishedStatus = 'failed'
    • count: number = 1000
    • timestamp: number = ...

    Returns Promise<number>

  • Parameters

    • jobId: string
    • stacktrace: string
    • failedReason: string

    Returns string[]

  • Parameters

    • client: RedisClient
    • jobSchedulerId: string
    • nextMillis: number

    Returns Promise<number>

  • Parameters

    • jobId: string
    • progress: number | object

    Returns Promise<void>

  • Parameters

    • client: RedisClient
    • customKey: string
    • nextMillis: number
    • legacyCustomKey: string

    Returns Promise<string>

Generated using TypeDoc