ergon_sup (ergon v0.5.0)
View SourceErgon's root supervisor.
Child order is the dependency order, and every step of it matters:
ergon_sql every consumer runs named statements through it
ergon_listener the node's shared LISTEN connection
ergon_worker_registry the pg scope; workers join it in their own init/1
ergon_job_notifier optional; dispatches wakes through the registry
ergon_worker_sup dynamic; queue workers appear under it at runtime
ergon_pgmq_consumer_sup dynamic; pgmq consumers likewiseone_for_one, so a notifier crash does not disturb running workers. The
notifier is the only optional child: without it workers still drain on their
fallback poll, correctly but with more latency.
ergon_listener precedes both the notifier and the consumer supervisor, because
both subscribe to it from their own init/1. It is started unconditionally even
when the job notifier is disabled, since a pgmq consumer may still want it.
The connection pool is not a child. ergon_app:start/2 starts it before this
tree and pgo_sup supervises it; see ergon_repo for why that is not turned
into a child spec.
Summary
Functions
-spec init([]) -> {ok, {supervisor:sup_flags(), [supervisor:child_spec()]}}.