pirmaryinfo fup

This commit is contained in:
2025-07-22 13:42:18 +02:00
parent a428e0d12f
commit aedf86573d

View File

@ -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 ${?}