The trigger of the storage reconciler (V205). It queues nothing to walk files
itself any more: since job runs (PhoenixKit.Jobs) the walk is a run per
library, Storage.Jobs.Reconcile, which an admin can watch and pause on
Settings → Media → Libraries and Admin → Jobs. This worker is what every place
that changes storage settings still queues (enqueue/0): its job starts those
runs (Reconcile.trigger/1) for the libraries that have files to bring up to
date.
Why a job rather than starting the runs directly: a profile or variant set
changes inside a transaction in several places, and a run cannot be started
from inside one (the engine refuses, so nothing it announces escapes a
rollback). An Oban insert commits with the caller's transaction and runs after
it. Only one pending trigger exists at a time (unique over [:worker, :queue]);
a job queued by an earlier release, with a cursor in its args, simply triggers.
Summary
Functions
Queues the trigger. Never raises: a change must not fail because Oban is not running (a test, a Mix task); the daily prune and the next boot queue one anyway.
Queues the trigger when any file is stale. Never raises.
Runs a whole pass in the calling process and returns the totals
(:reconciled, :stale, :skipped). For tests and Mix tasks.
Functions
@spec enqueue() :: :queued | :unavailable
Queues the trigger. Never raises: a change must not fail because Oban is not running (a test, a Mix task); the daily prune and the next boot queue one anyway.
@spec maybe_enqueue() :: :queued | :nothing_to_do | :unavailable
Queues the trigger when any file is stale. Never raises.
@spec run_pass() :: map()
Runs a whole pass in the calling process and returns the totals
(:reconciled, :stale, :skipped). For tests and Mix tasks.