diff --git a/lib/horde/dynamic_supervisor_impl.ex b/lib/horde/dynamic_supervisor_impl.ex index 52de323..5df97b3 100644 --- a/lib/horde/dynamic_supervisor_impl.ex +++ b/lib/horde/dynamic_supervisor_impl.ex @@ -240,7 +240,8 @@ defmodule Horde.DynamicSupervisorImpl do # signal to the rest of the nodes that this process has been relinquished # (to the Horde!) by its parent - Logger.error("Relinquishing #{inspect child_id}") + Logger.error("Relinquishing #{inspect(child_id)}") + with {_, child, _} <- get_item(state.processes_by_id, child_id) do DeltaCrdt.put( crdt_name(state.name), @@ -348,7 +349,8 @@ defmodule Horde.DynamicSupervisorImpl do end defp mark_dead(state, name) do - Logger.error("marking dead #{inspect name}") + Logger.error("marking dead #{inspect(name)}") + DeltaCrdt.put( crdt_name(state.name), {:member_node_info, name}, @@ -397,7 +399,8 @@ defmodule Horde.DynamicSupervisorImpl do end def handle_info({:crdt_update, diffs}, state) do - Logger.error("CRDT update: #{inspect diffs, pretty: true}") + Logger.error("CRDT update: #{inspect(diffs, pretty: true)}") + new_state = update_members(state, diffs) |> update_processes(diffs) @@ -458,7 +461,7 @@ defmodule Horde.DynamicSupervisorImpl do case current_member do %{status: :dead} -> - Logger.error("migrating process here #{inspect child_spec}") + Logger.error("migrating process here #{inspect(child_spec)}") DeltaCrdt.delete(crdt_name(state.name), {:process, child_spec.id}, :infinity) {_response, state} = add_child(randomize_child_id(child_spec), state) diff --git a/lib/horde/uniform_distribution.ex b/lib/horde/uniform_distribution.ex index e1f56ca..b8279ac 100644 --- a/lib/horde/uniform_distribution.ex +++ b/lib/horde/uniform_distribution.ex @@ -1,4 +1,5 @@ defmodule Horde.UniformDistribution do + require Logger @behaviour Horde.DistributionStrategy @moduledoc """ @@ -26,6 +27,11 @@ defmodule Horde.UniformDistribution do {:ok, Map.get(members, chosen_member)} end + |> tap(fn value -> + Logger.error( + "Choose node spec: #{inspect(child_spec)}, members: #{inspect(members)}, value: #{inspect(value)}" + ) + end) end def has_quorum?(_members), do: true