Durable.Storage.Schemas.ScheduledWorkflow (Durable v0.1.0-rc)

View Source

Ecto schema for scheduled workflow records.

Scheduled workflows represent cron-based recurring workflow executions.

Summary

Functions

Creates a changeset for inserting or updating a scheduled workflow.

Creates a changeset for enabling/disabling a scheduled workflow.

Creates a changeset that records a failure to load / start the scheduled workflow. Increments consecutive_failures and stamps last_error*. When the failure count reaches auto_disable_after, the schedule is automatically disabled and auto_disabled_at is set so operators can tell why the schedule stopped firing.

Creates a changeset for updating the last/next run times.

Creates a changeset that records a successful trigger. Resets consecutive_failures to 0 and clears the last_error fields.

Creates a changeset for updating a schedule's configuration.

Creates a changeset for upserting during registration.

Types

t()

@type t() :: %Durable.Storage.Schemas.ScheduledWorkflow{
  __meta__: term(),
  auto_disabled_at: DateTime.t() | nil,
  consecutive_failures: integer(),
  cron_expression: String.t(),
  enabled: boolean(),
  id: Ecto.UUID.t(),
  input: map(),
  inserted_at: DateTime.t(),
  last_error: String.t() | nil,
  last_error_at: DateTime.t() | nil,
  last_run_at: DateTime.t() | nil,
  name: String.t(),
  next_run_at: DateTime.t() | nil,
  queue: String.t(),
  timezone: String.t(),
  updated_at: DateTime.t(),
  workflow_module: String.t(),
  workflow_name: String.t()
}

Functions

changeset(scheduled_workflow, attrs)

Creates a changeset for inserting or updating a scheduled workflow.

enable_changeset(scheduled_workflow, enabled)

Creates a changeset for enabling/disabling a scheduled workflow.

failure_changeset(scheduled_workflow, error_message, opts \\ [])

Creates a changeset that records a failure to load / start the scheduled workflow. Increments consecutive_failures and stamps last_error*. When the failure count reaches auto_disable_after, the schedule is automatically disabled and auto_disabled_at is set so operators can tell why the schedule stopped firing.

run_changeset(scheduled_workflow, last_run_at, next_run_at)

Creates a changeset for updating the last/next run times.

success_changeset(scheduled_workflow, last_run_at, next_run_at)

Creates a changeset that records a successful trigger. Resets consecutive_failures to 0 and clears the last_error fields.

update_changeset(scheduled_workflow, attrs)

Creates a changeset for updating a schedule's configuration.

upsert_changeset(scheduled_workflow, attrs)

Creates a changeset for upserting during registration.

Updates cron, timezone, input, and queue, but preserves enabled status and run times for existing records.