@lesjoursfr/agenda
    Preparing search index...

    Class Job<DATA>

    Type Parameters

    • DATA = unknown | void
    Index

    Constructors

    • creates a new job object

      Type Parameters

      • DATA = unknown

      Parameters

      • agenda: Agenda
      • args: Partial<IJobParameters<void>> & { name: string; type: "normal" | "single" }
      • OptionalbyJobProcessor: boolean

      Returns Job<DATA>

    • Type Parameters

      • DATA = unknown

      Parameters

      • agenda: Agenda
      • args: Partial<IJobParameters<DATA>> & {
            data: DATA;
            name: string;
            type: "normal" | "single";
        }
      • OptionalbyJobProcessor: boolean

      Returns Job<DATA>

    Properties

    agenda: Agenda
    gotTimerToExecute: boolean

    internal variable to ensure a job does not set unlimited numbers of setTimeouts if the job is not processed immediately

    Methods

    • Parameters

      • Optionalerror: string | Error

      Returns void

    • Prevents the job from running

      Returns this

    • Fails the job with a reason (error) specified

      Parameters

      • reason: string | Error

      Returns this

    • if set, a job is forked via node child process and runs in a seperate/own thread

      Parameters

      • enableForkMode: boolean

      Returns this

    • Returns undefined | string | true | Error

    • Returns Promise<boolean>

    • Returns Promise<boolean>

    • A job is running if: (lastRunAt exists AND lastFinishedAt does not exist) OR (lastRunAt exists AND lastFinishedAt exists but the lastRunAt is newer [in time] than lastFinishedAt)

      Returns Promise<boolean>

      Whether or not job is running at the moment (true for running)

    • Sets priority of the job

      Parameters

      • priority: JobPriority

        priority of when job should be queued

      Returns this

    • Remove the job from database

      Returns Promise<number>

    • Sets a job to repeat at a specific time

      Parameters

      • time: string

      Returns this

    • Sets a job to repeat every X amount of time

      Parameters

      • interval: string | number
      • options: { skipImmediate?: boolean; timezone?: string } = {}

      Returns this

    • Saves a job to database

      Returns Promise<Job<unknown>>

    • Schedules a job to run at specified time

      Parameters

      • time: string | Date

      Returns this

    • Updates "lockedAt" time so the job does not get picked up again

      Parameters

      • Optionalprogress: number

        0 to 100

      Returns Promise<void>

    • Data to ensure is unique for job to be created

      Parameters

      • unique: Filter<Omit<IJobParameters<DATA>, "unique">>
      • Optionalopts: { insertOnly: boolean }

      Returns this