From: Christopher Date: Thu, 16 Apr 2020 13:27:05 +0000 (-0500) Subject: add some logging around live callee lookups X-Git-Url: http://git.entropealabs.com/?a=commitdiff_plain;h=baaabb217737750d8e8732c00f269ca55a42a667;p=wampex_router.git add some logging around live callee lookups --- diff --git a/lib/router/session.ex b/lib/router/session.ex index 978144e..36be7f7 100644 --- a/lib/router/session.ex +++ b/lib/router/session.ex @@ -740,17 +740,27 @@ defmodule Wampex.Router.Session do end end - defp get_live_callee(_proxy, [], _index, 0), do: {:error, :no_live_callees} - defp get_live_callee(_proxy, [], _index, _), do: {:error, :no_live_callees} + defp get_live_callee(_proxy, [], _index, 0) do + Logger.error("No live callees, tried all replicas") + {:error, :no_live_callees} + end + + defp get_live_callee(_proxy, [], _index, _) do + Logger.error("No live callees, empty result from lookup") + {:error, :no_live_callees} + end defp get_live_callee(proxy, callees, index, tries) when is_list(callees) do {_id, {pid, node}} = c = Enum.at(callees, index) + Logger.info("Seeing if live callee #{pid} on node #{node} is up...") case GenServer.call({proxy, node}, {:is_up, pid}) do true -> c false -> + Logger.error("#{pid} on #{node} is not live, trying next") + index = case index + 1 do ni when ni < length(callees) -> ni @@ -761,7 +771,10 @@ defmodule Wampex.Router.Session do end end - defp get_live_callee(_proxy, _, _index, _), do: {:error, :no_live_callees} + defp get_live_callee(_proxy, _, _index, _) do + Logger.error("No live callees, something odd happened") + {:error, :no_live_callees} + end defp send_to_peer(msg, transport, pid) do transport.send_request(pid, remove_nil_values(msg))