Start PubSub before Oban to prevent registry errors

Phoenix.PubSub must be initialized (creating its internal Registry)
before Oban starts processing jobs. With one_for_one strategy,
children start sequentially; previously Oban was started first,
causing 'unknown registry: MusicLibrary.PubSub' errors when a
job called broadcast before PubSub was ready (error #3891).
This commit is contained in:
Claudio Ortolina
2026-05-08 14:10:56 +01:00
parent 2e0ead75c4
commit be7a9d5990
+1 -1
View File
@@ -19,11 +19,11 @@ defmodule MusicLibrary.Application do
MusicLibrary.BackgroundRepo,
MusicLibrary.TelemetryRepo,
MusicLibraryWeb.Telemetry,
{Phoenix.PubSub, name: MusicLibrary.PubSub},
{Oban, Application.fetch_env!(:music_library, Oban)},
{Ecto.Migrator,
repos: Application.fetch_env!(:music_library, :ecto_repos), skip: skip_migrations?()},
{Task.Supervisor, name: MusicLibrary.TaskSupervisor},
{Phoenix.PubSub, name: MusicLibrary.PubSub},
# Start a worker by calling: MusicLibrary.Worker.start_link(arg)
# {MusicLibrary.Worker, arg},
# Start to serve requests, typically the last entry