Defines the failure policy for a step's or timeout's generated work.
AshWorkflow.Scheduler.Precise computes its own retry delay from this
struct, through delay_ms/2. AshWorkflow.Scheduler.Oban instead converts
backoff to the seconds ash_oban's trigger expects and hands that to
Transformer.build_entity!(AshOban, ...), and lets Oban do the waiting.
Summary
Functions
The delay in milliseconds before attempt number attempt + 1, given the
attempt number that just failed (1-based).
Types
@type backoff() :: AshWorkflow.Duration.t() | :exponential
@type t() :: %AshWorkflow.Entities.Retry{ __spark_metadata__: term(), backoff: backoff(), max_attempts: pos_integer() }
Functions
@spec delay_ms(t(), pos_integer()) :: non_neg_integer()
The delay in milliseconds before attempt number attempt + 1, given the
attempt number that just failed (1-based).
A fixed duration backoff is the same delay regardless of attempt.
:exponential uses Oban's default worker backoff formula, so
AshWorkflow.Scheduler.Precise and AshWorkflow.Scheduler.Oban agree on
timing: trunc(:math.pow(attempt, 4) + 15) * 1000. This has no jitter, so
the delay is deterministic and testable.