forge.timers
    Preparing search index...

    Class TimersManager

    Index
    • Cancels a running timer, leaving the database untouched.

      Parameters

      • kind: TimerKind

        The kind of the timer.

      • name: string

        The name of the timer.

      Returns boolean

      Whether anything was stopped, whether it was scheduled or already mid-run.

    • Runs a stored timer's code once, on demand.

      Parameters

      • kind: TimerKind

        The kind of the timer.

      • name: string

        The name of the timer.

      Returns Promise<boolean>

      Whether the code ran.

    • Whether a record is stored under this name, whatever is or is not armed for it.

      Parameters

      • kind: TimerKind

        The kind of the timer.

      • name: string

        The name of the timer.

      Returns Promise<boolean>

    • Puts a stored timer on hold, keeping what is left of its wait for resume.

      Parameters

      • kind: TimerKind

        The kind of the timer.

      • name: string

        The name of the timer.

      Returns Promise<boolean>

      Whether a running timer was put on hold.

    • Moves a stored timer's deadline, keeping everything else it was scheduled with.

      Parameters

      • kind: TimerKind

        The kind of the timer.

      • name: string

        The name of the timer.

      • duration: number

        The new delay for a timeout, or tick length for an interval, in ms.

      Returns Promise<boolean>

      Whether a stored timer was found and moved.

    • Gives a stored cron a new expression, keeping everything else it was scheduled with.

      Parameters

      • name: string

        The name of the cron.

      • expression: string

        The cron expression it should run on from now on.

      • Optionaltimezone: string | null

        The zone to read it in, or null to keep the one it already had.

      Returns Promise<boolean>

      Whether a stored cron was found and moved.

    • Starts a paused timer, from wherever its wait was left.

      Parameters

      • kind: TimerKind

        The kind of the timer.

      • name: string

        The name of the timer.

      Returns Promise<boolean>

      Whether a paused timer was started.

    • Stops everything armed and lets every name go, leaving the database alone. Unlike wipe nothing is forgotten, so the next boot picks the records back up.

      Returns void

    • Schedules a timer and persists it.

      Parameters

      • timer: Timer

        The timer to schedule.

      • run: () => Promise<void>

        What it executes when it fires.

      Returns Promise<Timer>

    • Cancels every running timer and empties the table.

      Returns Promise<number>

      The number of running timers that were cancelled.