bitwalker / swarm

Easy clustering, registration, and distribution of worker processes for Erlang/Elixir
MIT License
1.2k stars 103 forks source link

fix issue with StaticQuorumRing size #75

Closed kelostrada closed 6 years ago

kelostrada commented 6 years ago

When loading envs from erlang variables in releases the variables are loaded as strings as far as I know.

Then this happens: "5" < 2

Which results in always giving :undefined as a proposed node by StaticQuorumRing

bitwalker commented 6 years ago

I think I would rather take a slightly different approach to this. The default type of the configuration should be an integer, but we could support binaries by casing the result of Application.get_env/3 to see if it is an integer or a binary, and call Integer.parse/1 if it is a binary. This also allows us to validate the value for :static_quorum_size to ensure it's a non-zero, positive integer, and raise if invalid. Can you make that change?

kelostrada commented 6 years ago

Sure I'll get to that tomorrow :) Do you want some custom type of exception or just raise a message?

kelostrada commented 6 years ago

I've updated the PR with your suggestions, please review again

bitwalker commented 6 years ago

Thanks!