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
The text was updated successfully, but these errors were encountered:
balena
added a commit
to team-telnyx/swarm
that referenced
this issue
May 14, 2020
swarm/lib/swarm/tracker/tracker.ex
Line 1187 in 4aee63d
By definition,
Swarm.Distribution.Strategy.key_to_node/2
can returnnode() | :undefined
. However this exact line is actually accepting{:error, {:invalid_ring, :no_nodes}}
as a valid return value, which is actually whatHashRing.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:The text was updated successfully, but these errors were encountered: