Skip to content

Commit 2c05217

Browse files
author
Andrei Zavada
committed
apply NODETOOL_NODE_PREFIX patch from github.com/erlware/relx/pull/871
1 parent e702e3a commit 2c05217

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

priv/bin_script

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,14 @@ relx_rem_sh() {
7777

7878
# Generate a random id
7979
relx_gen_id() {
80-
od -X -N 4 /dev/urandom | head -n1 | awk '{print $2}'
80+
# To prevent exhaustion of atoms on target node, optionally avoid
81+
# generation of random node prefixes, if it is guaranteed calls
82+
# are always sequential.
83+
if [ -z "${NODETOOL_NODE_PREFIX}" ]; then
84+
dd count=1 bs=4 if=/dev/urandom 2> /dev/null | od -x | head -n1 | awk '{print $2$3}'
85+
else
86+
echo "${NODETOOL_NODE_PREFIX}"
87+
fi
8188
}
8289

8390
# Control a node

0 commit comments

Comments
 (0)