Type alias CommonJobOptions

CommonJobOptions: {
    id: string;
    log?: boolean;
    maxFails?: number;
    maxRetries?: number;
    maxRuns?: number;
    onFail?: ((error) => void | Promise<void>);
    onFinish?: (() => void | Promise<void>);
    onPause?: (() => void | Promise<void>);
    onResume?: (() => void | Promise<void>);
    onRetry?: (() => void | Promise<void>);
    onRun?: (() => void | Promise<void>);
    onStart?: (() => void | Promise<void>);
    onStop?: (() => void | Promise<void>);
    once?: boolean;
    retryTimeout?: number;
    run: JobRunFunction;
    timeout?: number;
    timeoutOnPause?: number;
}

Type declaration

  • id: string

    The unique identifier for this job

  • Optional log?: boolean

    Wether or not we should perform logging for this job

  • Optional maxFails?: number

    The maximum number of times this job should fail, a job fails when the maxRetries is reached and the job still throws an error

  • Optional maxRetries?: number

    The maximum number of times this job should retry, a job retries when it throws an error

  • Optional maxRuns?: number

    The maximum number of times this job should run before being considered finished

  • Optional onFail?: ((error) => void | Promise<void>)

    The function to run when this job is failed, onFail is emitted when maxRetries is reached for a job

      • (error): void | Promise<void>
      • Parameters

        • error: Error

        Returns void | Promise<void>

  • Optional onFinish?: (() => void | Promise<void>)

    The function to run when this job is finished, onFinish is emitted when maxRuns is reached or once is true

      • (): void | Promise<void>
      • Returns void | Promise<void>

  • Optional onPause?: (() => void | Promise<void>)

    The function to run when this job is paused

      • (): void | Promise<void>
      • Returns void | Promise<void>

  • Optional onResume?: (() => void | Promise<void>)

    The function to run when this job is resumed

      • (): void | Promise<void>
      • Returns void | Promise<void>

  • Optional onRetry?: (() => void | Promise<void>)

    The function to run when this job is retried because an error was encountered

      • (): void | Promise<void>
      • Returns void | Promise<void>

  • Optional onRun?: (() => void | Promise<void>)

    The function to run when this job is run

      • (): void | Promise<void>
      • Returns void | Promise<void>

  • Optional onStart?: (() => void | Promise<void>)

    The function to run when this job is started

      • (): void | Promise<void>
      • Returns void | Promise<void>

  • Optional onStop?: (() => void | Promise<void>)

    The function to run when this job is stopped, onStop is emitted when maxFails is reached

      • (): void | Promise<void>
      • Returns void | Promise<void>

  • Optional once?: boolean

    Whether or not this job should only run once

    Default

    false
    
  • Optional retryTimeout?: number

    The retry delay/timeout in milliseconds

  • run: JobRunFunction

    The function to run

  • Optional timeout?: number

    The start delay/timeout in milliseconds

  • Optional timeoutOnPause?: number

    The pause delay/timeout in milliseconds - how long should we wait before checking if the job has resumed