Skip to content

Commit

Permalink
Merge pull request nacos-group#203 from wangweizZZ/master
Browse files Browse the repository at this point in the history
减少文件修改,避免nacos监听文件变更时可能读取到不正确节点信息
  • Loading branch information
paderlol authored Apr 16, 2021
2 parents 6ac32ae + 3c5b4ed commit 7ffe16e
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions plugin/peer/on-change.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ while read -ra LINE; do
PEERS=("${PEERS[@]}" $LINE)
done

echo "" > "${CLUSTER_CONF}"

if [ ${#PEERS[@]} -eq 1 ]; then

echo "${PEERS[0]}:$NACOS_APPLICATION_PORT" > "${CLUSTER_CONF}"
exit
fi
CONTENT=""
for peer in "${PEERS[@]}"; do
echo "${peer}:$NACOS_APPLICATION_PORT" >> "${CLUSTER_CONF}"
CONTENT="${CONTENT}${peer}:$NACOS_APPLICATION_PORT\n"
done

echo "on change write peers:"${PEERS}
echo -e "${CONTENT%\\n}" > "${CLUSTER_CONF}"
echo "on change write peers:"${PEERS[@]}

0 comments on commit 7ffe16e

Please sign in to comment.