fix: wait for PostgreSQL initialization
This commit is contained in:
+5
-2
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user