Continuum.RecurringSchedules (continuum v0.8.5)

Copy Markdown View Source

UTC interval schedule definitions, separate from their one-shot occurrences.

Definitions pin a workflow version and input. The existing schedule runner atomically advances each definition's cursor while inserting uniquely named occurrences. Each occurrence then uses the ordinary one-shot retry path and stable run ID. No additional runtime process is required.

Summary

Functions

Creates an interval definition and returns its ID.

Loads a definition, including its next occurrence cursor and recorded policies.

Lists definitions with :limit (1–100), :cursor, and optional :namespace.

Lists occurrences with :limit (1–100) and :cursor; each row includes its stable run ID.

Functions

create(workflow, input, every_ms, opts \\ [])

@spec create(module(), term(), pos_integer(), keyword()) ::
  {:ok, binary()} | {:error, term()}

Creates an interval definition and returns its ID.

every_ms must be at least 1,000. :starts_at is an optional UTC DateTime; its default is one interval from now. Calendar/cron and non-UTC zones are not supported: intervals measure elapsed milliseconds and have no DST rules.

Required options:

  • overlap: :allow | :skip — allow simultaneous occurrences, or record an overlap skip while an earlier occurrence is queued/starting or has any active run in its continuation chain.

  • missed: :catch_up | :skip — generate overdue times oldest-first, or coalesce overdue times into the most recent due time and advance beyond now. Coalescing does not create rows for the older omitted times.

:max_catch_up (1–100, default 10) bounds occurrences per definition per poll; the runner's batch size also bounds the total across definitions. Overlap skips count against this budget. Pausing retains the cursor; resume applies the same missed policy. Existing occurrences continue while paused.

Also accepts :instance, :id, :namespace, :attributes, and :trace_context. A duplicate definition ID returns a changeset error; use the existing definition ID for inspection or pause/resume.

get(id, opts \\ [])

Loads a definition, including its next occurrence cursor and recorded policies.

list(opts \\ [])

Lists definitions with :limit (1–100), :cursor, and optional :namespace.

occurrences(id, opts \\ [])

Lists occurrences with :limit (1–100) and :cursor; each row includes its stable run ID.