AshWorkflow.Verifiers.ValidateTimeoutPrecision (AshWorkflow v0.6.0)

Copy Markdown View Source

Rejects timeouts whose deadline is shorter than the selected scheduler can honour.

The floor comes from the scheduler, through AshWorkflow.Scheduler.precision_floor_ms/1. AshWorkflow.Scheduler.Oban polls on a cron interval, and cron's finest granularity is one minute — Oban.Cron zeroes the seconds field and its scheduler only wakes on minute boundaries — so a deadline shorter than a minute cannot be honoured there. fire_after: {30, :seconds} compiles happily and then fires anywhere up to 60 seconds late, an error larger than the deadline itself.

Rather than let the DSL make a promise the scheduler cannot keep, a deadline under the floor is a compile error unless the timeout sets self_scheduled?: true, which asserts that something other than the scheduler drives the trigger at the resolution the deadline needs.

AshWorkflow.Scheduler.Precise arms a timer per deadline, so its floor is a millisecond and a sub-minute timeout needs no flag.