From be7a9d5990a66ce3cc8c93cb237771e7e068ac5e Mon Sep 17 00:00:00 2001 From: Claudio Ortolina Date: Fri, 8 May 2026 14:10:56 +0100 Subject: [PATCH] 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). --- lib/music_library/application.ex | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/music_library/application.ex b/lib/music_library/application.ex index d0a29e1d..b64c619e 100644 --- a/lib/music_library/application.ex +++ b/lib/music_library/application.ex @@ -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