GenDurable.Executor (gen_durable v0.1.3)

Copy Markdown View Source

Runs one picked instance to a committed outcome (spec §3/§4).

Resolves the FSM module, loads the jsonb state into the FSM's struct, snapshots the signal inbox, calls step/2 under try. A raised exception routes to handle/2 (spec §4.2); if handle/2 itself raises, the instance fails. A worker crash (no return at all) is not handled here — it is the reaper's job (spec §4.3), the at-least-once safety floor.

Signal consumption (spec §5): a step sees the awaited subset as ctx.awaited (only the signals whose name is in the set it parked on) and the whole inbox as ctx.all. On a progressing outcome the engine deletes exactly the ctx.awaited ids the step received — latecomers and never-awaited signals survive; a terminal outcome clears the whole inbox (cleanup); :replay/:await delete nothing. Deletion happens in SQL, by id.

Summary

Functions

Execute job (a map returned by Queries.pick/5). config is %{repo: ...}. Returns the validated outcome tuple.

Functions

run(config, job)

Execute job (a map returned by Queries.pick/5). config is %{repo: ...}. Returns the validated outcome tuple.