AshWorkflow.Calculations.PendingDeadlines (AshWorkflow v0.7.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. It is not a record of what has already fired.

For a transition timeout that distinction does not arise: firing changes the state, so the deadline leaves the list. But a non-repeating action timeout does not change state, so its deadline keeps being derivable after it has fired, and it will still appear here with a due_at in the past. Read a past due_at as "was due", not "will fire".

An every entry does not have the stale-past-due_at problem a non-repeating action timeout has: 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.