Skip to content

Commit

Permalink
Solving bitwalker#140
Browse files Browse the repository at this point in the history
  • Loading branch information
balena committed May 14, 2020
1 parent 55ee480 commit cfb6678
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 6 additions & 1 deletion lib/swarm/distribution/ring.ex
Expand Up @@ -7,5 +7,10 @@ defmodule Swarm.Distribution.Ring do
def add_node(ring, node, weight), do: HashRing.add_node(ring, node, weight)
def add_nodes(ring, nodes), do: HashRing.add_nodes(ring, nodes)
def remove_node(ring, node), do: HashRing.remove_node(ring, node)
def key_to_node(ring, key), do: HashRing.key_to_node(ring, key)
def key_to_node(ring, key) do
case HashRing.key_to_node(ring, key) do
{:error, _reason} -> :undefined
node -> node
end
end
end
2 changes: 1 addition & 1 deletion lib/swarm/tracker/tracker.ex
Expand Up @@ -1188,7 +1188,7 @@ defmodule Swarm.Tracker do
debug "The node #{worker_name} was not found in the registry"
entry(name: name, pid: pid, meta: %{mfa: _mfa} = meta) = obj ->
case Strategy.remove_node(state.strategy, state.self) |> Strategy.key_to_node(name) do
{:error, {:invalid_ring, :no_nodes}} ->
:undefined ->
debug "Cannot handoff #{inspect name} because there is no other node left"
other_node ->
debug "#{inspect name} has requested to be terminated and resumed on another node"
Expand Down

0 comments on commit cfb6678

Please sign in to comment.