From 8ce3cf6e665a5082b2170c59ddb81042629ae11c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=94=D0=BC=D0=B8=D1=82=D1=80=D0=B8=D0=B9=20=D0=9C=D0=B0?= =?UTF-8?q?=D0=BC=D0=B5=D0=B4=D0=BE=D0=B2?= Date: Wed, 10 Jun 2026 17:52:49 +0300 Subject: [PATCH] replace for loop with while loop for postgres wait --- install.sh | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/install.sh b/install.sh index 4ea87df..803e7d4 100644 --- a/install.sh +++ b/install.sh @@ -250,19 +250,20 @@ fi info "Waiting for PostgreSQL (up to 60s)..." DB_READY=false -for ((i=1; i<=30; i++)); do - if $SUDO docker compose exec -T postgres pg_isready -U "${POSTGRES_USER}" -d "${POSTGRES_DB}" &>/dev/null; then +I=1 +while [ "$I" -le 30 ]; do + if $SUDO docker compose exec -T postgres pg_isready -U "${POSTGRES_USER}" -d "${POSTGRES_DB}" >/dev/null 2>&1; then DB_READY=true info "PostgreSQL is ready" break fi - if [ "$i" -eq 30 ]; then - warn "PostgreSQL logs (last 20 lines):" - $SUDO docker compose logs --tail=20 postgres 2>/dev/null || true - error "PostgreSQL did not start. Check ${INSTALL_DIR}/.env for DB credentials and port 5432 availability." + if [ "$I" -eq 30 ]; then + echo "=== PG LOOP TIMEOUT ===" fi + I=$((I + 1)) sleep 2 done +echo "=== AFTER PG LOOP ===" echo "=== CHECKPOINT: after postgres loop ==="