Service Health Checks with Retries
Service Health Checks with Retries
Exponential backoff health check loop:
wait_for_service() {
local url="$1"
local retries=5
local wait_sec=2
until curl -sSf "$url" >/dev/null || [ $retries -eq 0 ]; do
echo "Service unavailable, retrying in ${wait_sec}s..."
sleep "$wait_sec"
(( retries-- ))
(( wait_sec *= 2 ))
done
}