You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By definition, Swarm.Distribution.Strategy.key_to_node/2 can return node() | :undefined. However this exact line is actually accepting {:error, {:invalid_ring, :no_nodes}} as a valid return value, which is actually what HashRing.key_to_node/2 returns in case of error.
So Swarm.Distribution.Ring.key_to_node/2 should actually return :undefined instead of {:error, reason} to honour the strategy definition:
defmodule Swarm.Distribution.Ring do
...
def key_to_node(ring, key) do
case HashRing.key_to_node(ring, key) do
{:error, _reason} -> :undefined
node -> node
end
end
end