Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: enable remote node beacon autoload #307

Merged
merged 1 commit into from
Nov 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/beacon/live_admin/cluster.ex
Original file line number Diff line number Diff line change
Expand Up @@ -68,9 +68,17 @@ defmodule Beacon.LiveAdmin.Cluster do
end

node = pick_node(nodes)
enable_beacon_autoload(site, node)
do_call(site, node, mod, fun, args)
end

# Before a function call is made to the remote node,
# we need to enable Beacon's ErrorHandler (module autoload)
# because that call might depend on modules that have not been loaded yet.
defp enable_beacon_autoload(site, node) do
do_call(site, node, Beacon.ErrorHandler, :enable, [site])
end

defp do_call(site, node, mod, fun, args) do
if node == Node.self() do
apply(mod, fun, args)
Expand Down
Loading