pirmaryinfo fup
This commit is contained in:
@ -16,17 +16,27 @@ pingSentinel() {
|
||||
|
||||
getPrimaryInfo() {
|
||||
masterName=${VALKEY_MASTER_NAME:-"mymaster"}
|
||||
it="${1:-0}"
|
||||
|
||||
info=$(valkey-cli --csv -h ${VALKEY_HEADLESS_SERVICE} -p ${VALKEY_SENTINEL_PORT} sentinel get-primary-addr-by-name "${masterName}"| \
|
||||
awk -F ',' '{ gsub(/"/,"",$0); print $1 " " $2 }')
|
||||
|
||||
if [ -z "${info}" ]; then
|
||||
echo "Failed to get primary info for master '${masterName}'"
|
||||
getPrimaryInfo
|
||||
#return 1
|
||||
it=$((it + 1))
|
||||
getPrimaryInfo ${it}
|
||||
if [ ${it} -ge 10 ]; then
|
||||
echo "Failed to get primary info after 5 attempts"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
if [[ "${info}" =~ /^NULL/ ]]; then
|
||||
getPrimaryInfo
|
||||
it=$((it + 1))
|
||||
getPrimaryInfo ${it}
|
||||
if [ ${it} -ge 10 ]; then
|
||||
echo "Failed to get primary info after 5 attempts"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
echo "${info}"
|
||||
return ${?}
|
||||
|
Reference in New Issue
Block a user