blob: 8be92ffca3eebf5a18a05eb51802a7fab899023e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#!/usr/bin/env bash
set -euo pipefail
: "${AIGW_READY_URL:?AIGW_READY_URL is required}"
: "${AIGW_REDIS_CONTAINER:?AIGW_REDIS_CONTAINER is required}"
cleanup() { docker start "$AIGW_REDIS_CONTAINER" >/dev/null 2>&1 || true; }
trap cleanup EXIT
docker stop "$AIGW_REDIS_CONTAINER" >/dev/null
for _ in $(seq 1 20); do
body="$(curl --silent --show-error --fail "$AIGW_READY_URL" || true)"
if printf '%s' "$body" | grep -q '"redis"' && printf '%s' "$body" | grep -q '"required":false'; then
printf 'redis degradation confirmed; gateway remained ready\n'
exit 0
fi
sleep 1
done
printf 'gateway did not report recoverable Redis degradation\n' >&2
exit 1
|