UNPKG

toad-scheduler

Version:

In-memory Node.js and browser job scheduler

30 lines (29 loc) 1.21 kB
import { AsyncTask } from '../../common/AsyncTask'; import { Job, JobStatus } from '../../common/Job'; import { Task } from '../../common/Task'; import { JobOptions } from './SimpleIntervalJob'; import { SimpleIntervalSchedule } from './SimpleIntervalSchedule'; export declare class LongIntervalJob extends Job { private childJob?; private timer?; private readonly schedule; private readonly task; private readonly preventOverrun; constructor(schedule: SimpleIntervalSchedule, task: Task | AsyncTask, options?: JobOptions); private setTimeEatingJob; /** * Start the job. * * Lifecycle invariant: the underlying timer (or childJob, for the * time-eating path used when the interval exceeds setInterval's * ~24.85d cap) is brought up first, and any `runImmediately` * execution happens last. Both paths share the rule, so a `stop()` * issued from inside the immediate task always finds an active * timer to clear (#176), and `runImmediately` is honored on the * time-eating path too (#193, #212). `SimpleIntervalJob.start()` * follows the same shape. */ start(): void; stop(): void; getStatus(): JobStatus; }