diff --git a/worker/src/entrypoint.sh b/worker/src/entrypoint.sh index ccbdc46..bfbb2a9 100644 --- a/worker/src/entrypoint.sh +++ b/worker/src/entrypoint.sh @@ -9,15 +9,13 @@ echo "[entrypoint] Waiting for database to be ready..." # Wait for PostgreSQL to accept connections (max 30s retries) for i in $(seq 1 30); do - if python -c "import asyncpg,os; asyncio.get_event_loop().run_until_complete( - asyncpg.connect( - host=os.getenv('POSTGRES_HOST','db'), - port=int(os.getenv('POSTGRES_PORT','5432')), - user=os.getenv('POSTGRES_USER','postgres'), - password=os.getenv('POSTGRES_PASSWORD'), - database=os.getenv('POSTGRES_DB','postgres'), - ) - )" 2>/dev/null; then + if python -c "import asyncpg,os,asyncio; asyncio.run(asyncpg.connect( + host=os.getenv('POSTGRES_HOST','db'), + port=int(os.getenv('POSTGRES_PORT','5432')), + user=os.getenv('POSTGRES_USER','postgres'), + password=os.getenv('POSTGRES_PASSWORD'), + database=os.getenv('POSTGRES_DB','postgres'), + ))" 2>/dev/null; then echo "[entrypoint] Database is ready." break fi