diff --git a/lib/beacon/error_handler.ex b/lib/beacon/error_handler.ex index 0789f937..7acc347c 100644 --- a/lib/beacon/error_handler.ex +++ b/lib/beacon/error_handler.ex @@ -51,6 +51,8 @@ defmodule Beacon.ErrorHandler do defp load_beacon_resource(nil = _site, _resource), do: false defp load_beacon_resource(site, resource) do + IO.inspect("LOADING #{resource} for #{site}") + case resource do "Page" <> page_id -> Loader.load_page_module(site, page_id) "Layout" <> layout_id -> Loader.load_layout_module(site, layout_id) diff --git a/lib/beacon/loader/worker.ex b/lib/beacon/loader/worker.ex index 5300d0ea..c2b56c7a 100644 --- a/lib/beacon/loader/worker.ex +++ b/lib/beacon/loader/worker.ex @@ -571,6 +571,7 @@ defmodule Beacon.Loader.Worker do {:ok, _pid} -> # we are the first worker, let's do the work load_fn.() + Registry.unregister(Beacon.Registry, module) module {:error, {:already_registered, pid}} -> @@ -580,7 +581,7 @@ defmodule Beacon.Loader.Worker do receive do {:DOWN, _ref, :process, _pid, {:shutdown, :loaded}} -> module after - 10_000 -> :error + 1_000 -> :error end end end diff --git a/test/beacon/content_test.exs b/test/beacon/content_test.exs index 4e2b0306..390ee12c 100644 --- a/test/beacon/content_test.exs +++ b/test/beacon/content_test.exs @@ -129,12 +129,6 @@ defmodule Beacon.ContentTest do assert_receive {:page_published, %{site: ^site, id: ^id}} end - test "broadcasts loaded event" do - :ok = Beacon.PubSub.subscribe_to_page(:booted, "/broadcast-test") - beacon_published_page_fixture(site: "booted", path: "/broadcast-test") - assert_receive {:page_loaded, %{site: :booted}} - end - test "broadcasts unpublished event" do %{site: site, id: id, path: path} = page = beacon_published_page_fixture(site: "booted") :ok = Beacon.PubSub.subscribe_to_pages(site) diff --git a/test/beacon/loader/error_page_test.exs b/test/beacon/loader/error_page_test.exs index cb5717e3..5db68dc9 100644 --- a/test/beacon/loader/error_page_test.exs +++ b/test/beacon/loader/error_page_test.exs @@ -11,7 +11,7 @@ defmodule Beacon.Loader.ErrorPageTest do setup %{conn: conn} do :ok = Beacon.Loader.populate_default_layouts(default_site()) :ok = Beacon.Loader.populate_default_error_pages(default_site()) - {:ok, error_module} = Beacon.Loader.load_error_page_module(default_site()) + error_module = Beacon.Loader.load_error_page_module(default_site()) [conn: build_conn(conn), error_module: error_module] end