Skip to content

Commit

Permalink
some fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
APB9785 committed Nov 13, 2024
1 parent cd5297c commit b7a592a
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 8 deletions.
2 changes: 2 additions & 0 deletions lib/beacon/error_handler.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

Check warning on line 54 in lib/beacon/error_handler.ex

View workflow job for this annotation

GitHub Actions / quality: OTP 27 | Elixir 1.17 | Phoenix ~> 1.7 | LV ~> 1.0.0-rc.7

There should be no calls to `IO.inspect/1`.

case resource do
"Page" <> page_id -> Loader.load_page_module(site, page_id)
"Layout" <> layout_id -> Loader.load_layout_module(site, layout_id)
Expand Down
3 changes: 2 additions & 1 deletion lib/beacon/loader/worker.ex
Original file line number Diff line number Diff line change
Expand Up @@ -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}} ->
Expand All @@ -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
Expand Down
6 changes: 0 additions & 6 deletions test/beacon/content_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion test/beacon/loader/error_page_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit b7a592a

Please sign in to comment.