AshWorkflow.Calculations.PendingDeadlines (AshWorkflow v0.10.0)

Copy Markdown View Source

Ash calculation listing the timeouts and every entries still ahead of a record in its current step, soonest first.

Each entry is a map with :name, :due_at, :kind (:action, :transition or :every) and :target (the destination step for transition timeouts, nil otherwise).

What this is not

This is the schedule implied by the DSL and the record's current field values — field + fire_after, or the fire_at field itself, computed on read.

A deadline leaves the list once it has fired. A transition timeout changes the state when it fires. An action timeout does not, so its entry is omitted while its <step>_<timeout>_fired_at column holds an instant at or after its due_at. A timeout that is due but has not fired yet still appears with a due_at in the past.

Firing an every writes its own last-fired column, so its due_at is always the next instant it will run.

A timeout whose field is nil on the record has no derivable deadline and is omitted. An every whose column is nil is different: it has never fired, and its interval is measured from state_entered_at instead — see AshWorkflow.Entities.Every — so its entry reports one whole interval after the record entered the step, rather than being omitted.

Summary

Functions

describe(opts)

Callback implementation for Ash.Resource.Calculation.describe/1.

has_calculate?()

has_expression?()

Callback implementation for Ash.Resource.Calculation.has_expression?/0.

strict_loads?()

Callback implementation for Ash.Resource.Calculation.strict_loads?/0.