From 03e2d8343e9b0fa47f1a376f36bd3b9e36975bf8 Mon Sep 17 00:00:00 2001 From: Stephen Adamson Date: Sun, 22 Feb 2026 00:25:55 +0000 Subject: [PATCH] fix: add 5-second buffer after PostgreSQL startup before database operations - PostgreSQL reports ready (SELECT 1 succeeds) but internal initialization still in progress - Add explicit 5-second sleep after 'PostgreSQL is ready' message - Ensures database system fully initialized before creating/seeding test database - Prevents 'database system is starting up' errors - Also increase sleep after database creation from 1s to 2s for stability --- local-dev-2.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/local-dev-2.sh b/local-dev-2.sh index adc9b15..439794c 100755 --- a/local-dev-2.sh +++ b/local-dev-2.sh @@ -71,10 +71,14 @@ if [ $STARTUP_ATTEMPT -eq $MAX_STARTUP_ATTEMPTS ]; then exit 1 fi +# --- 3a-extra. Additional wait for full PostgreSQL initialization --- +log_step "Allowing PostgreSQL to fully initialize..." +sleep 5 + # --- 3b. Create Test Database --- log_step "Setting up test database (crussell_test)..." docker exec postgres psql -U myuser -d mydb -c "CREATE DATABASE crussell_test;" 2>&1 || log_info "Test database may already exist" -sleep 1 +sleep 2 # --- 3c. Seed Test Database Schema --- log_step "Seeding test database schema..."