Выполнение 3 лабораторной на оценку 3
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#!/bin/sh
|
||||
set -eu
|
||||
python - <<'PY'
|
||||
import os, time
|
||||
from sqlalchemy import create_engine, text
|
||||
url = os.environ["DATABASE_URL"]
|
||||
engine = create_engine(url, connect_args={"connect_timeout": 3})
|
||||
for attempt in range(60):
|
||||
try:
|
||||
with engine.connect() as connection:
|
||||
connection.execute(text("SELECT 1"))
|
||||
break
|
||||
except Exception:
|
||||
if attempt == 59:
|
||||
raise
|
||||
time.sleep(1)
|
||||
PY
|
||||
exec "$@"
|
||||
Reference in New Issue
Block a user