fix: use asyncio.run() in entrypoint for Python 3.12 compatibility
CI / lint-and-test (push) Has been cancelled
CI / lint-and-test (push) Has been cancelled
This commit is contained in:
@@ -9,15 +9,13 @@ echo "[entrypoint] Waiting for database to be ready..."
|
|||||||
|
|
||||||
# Wait for PostgreSQL to accept connections (max 30s retries)
|
# Wait for PostgreSQL to accept connections (max 30s retries)
|
||||||
for i in $(seq 1 30); do
|
for i in $(seq 1 30); do
|
||||||
if python -c "import asyncpg,os; asyncio.get_event_loop().run_until_complete(
|
if python -c "import asyncpg,os,asyncio; asyncio.run(asyncpg.connect(
|
||||||
asyncpg.connect(
|
host=os.getenv('POSTGRES_HOST','db'),
|
||||||
host=os.getenv('POSTGRES_HOST','db'),
|
port=int(os.getenv('POSTGRES_PORT','5432')),
|
||||||
port=int(os.getenv('POSTGRES_PORT','5432')),
|
user=os.getenv('POSTGRES_USER','postgres'),
|
||||||
user=os.getenv('POSTGRES_USER','postgres'),
|
password=os.getenv('POSTGRES_PASSWORD'),
|
||||||
password=os.getenv('POSTGRES_PASSWORD'),
|
database=os.getenv('POSTGRES_DB','postgres'),
|
||||||
database=os.getenv('POSTGRES_DB','postgres'),
|
))" 2>/dev/null; then
|
||||||
)
|
|
||||||
)" 2>/dev/null; then
|
|
||||||
echo "[entrypoint] Database is ready."
|
echo "[entrypoint] Database is ready."
|
||||||
break
|
break
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user