Skip to content

Commit

Permalink
Merge pull request #868 from hmmr/patch-1
Browse files Browse the repository at this point in the history
use random:uniform instead of os:pid when constructing node name in nodetool
  • Loading branch information
tsloughter authored Aug 25, 2021
2 parents 99b570a + ea96033 commit e6c3ae4
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions priv/templates/nodetool
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ epmd_path() ->


nodename(Name) ->
case re:split(Name, "@", [{return, list}, unicode]) of
case re:split(Name, "@", [unicode, {return, list}]) of
[_Node, _Host] ->
list_to_atom(Name);
[Node] ->
Expand All @@ -153,11 +153,12 @@ nodename(Name) ->
end.

append_node_suffix(Name, Suffix) ->
rand:seed(exsss, os:timestamp()),
case re:split(Name, "@", [{return, list}, unicode]) of
[Node, Host] ->
list_to_atom(lists:concat([Node, Suffix, os:getpid(), "@", Host]));
list_to_atom(lists:concat([Node, Suffix, rand:uniform(1000), "@", Host]));
[Node] ->
list_to_atom(lists:concat([Node, Suffix, os:getpid()]))
list_to_atom(lists:concat([Node, Suffix, rand:uniform(1000)]))
end.

%% convert string to erlang term
Expand Down

0 comments on commit e6c3ae4

Please sign in to comment.