From 197be0a964b8b786f399b5e88588b830faf1addd Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 30 Aug 2026 14:42:34 +0000 Subject: [PATCH] fix: wait for PostgreSQL initialization --- install.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/install.sh b/install.sh index b570e6c..26870b4 100644 --- a/install.sh +++ b/install.sh @@ -204,8 +204,11 @@ if [[ $PG_HOST == postgres ]]; then fi if [[ $PG_HOST == postgres ]]; then ready=0 - for elapsed in $(seq 0 118 2); do - "${COMPOSE[@]}" --profile local-db --project-directory "$INSTALL_DIR" --env-file "$INSTALL_DIR/.env" -f "$INSTALL_DIR/compose.yaml" exec -T postgres pg_isready -U "$PG_USER" -d "$PG_DB" >/dev/null 2>&1 && { ready=1; break; } + for elapsed in $(seq 0 298 2); do + if "${COMPOSE[@]}" --profile local-db --project-directory "$INSTALL_DIR" --env-file "$INSTALL_DIR/.env" -f "$INSTALL_DIR/compose.yaml" exec -T postgres pg_isready -U "$PG_USER" -d "$PG_DB" >/dev/null 2>&1; then + ready=1 + break + fi printf '\033[2K\r[%d/%d] 等待 PostgreSQL 就绪(%s 秒)' "$STEP" "$TOTAL_STEPS" "$elapsed" sleep 2 done