Class CronJobAbstract

A cron job that run periodically based on the provided cron expression.

Hierarchy (View Summary)

Constructors

Properties

initialConfig: InitialCronConfig

The initial config of the cron job.

Accessors

Methods

  • Changes the cron expression.

    Parameters

    • cronExpression: string

      The new cron expression to change to.

    Returns Promise<void>

  • The method that is called on every cron execution.

    Returns void | Promise<void>

  • Runs whenever the execution of the cron job throws an error. This is a wrapper around this.onError that already provides things like disabling the cron job if it's configured that way and logging the error.

    Parameters

    • error: unknown

      The error that was thrown.

    Returns Promise<void>

  • Runs whenever the cron expression fires. This is a wrapper around this.onTick that takes care of validation, error handling and updating cron job data.

    Returns Promise<void>

  • Updates the cron jobs.

    Parameters

    • data: Partial

      The data to update the cron job with.

    Returns Promise<void>