Skip to main content

Function: nextOccurrence()

function nextOccurrence(schedule, from): number;

Defined in: packages/client/src/core/job-engine/schedule.ts:134

The first moment this schedule comes due strictly after from.

The occurrences between the last run and from are not returned, and there is no way to ask for them. That absence is the design: a device that was closed for a fortnight has missed fourteen occurrences of a daily job, and replaying them would run the campaign fourteen times over data that only justifies running it once. A sweep that reads current state does the right thing in a single pass; fourteen sweeps do the same thing plus a stampede.

Parameters

ParameterTypeDescription
scheduleParsedScheduleA parsed schedule.
fromnumberThe instant to measure from, normally "now".

Returns

number

The next due timestamp, strictly greater than from.