logical fix

This commit is contained in:
vabene1111 2022-03-02 12:22:54 +01:00
parent 0f3d82a5e6
commit 8010ee3dca

View File

@ -28,12 +28,14 @@ fi
echo "Waiting for database to be ready..." echo "Waiting for database to be ready..."
if [ "${DB_ENGINE}" != 'django.db.backends.sqlite3' ]; then
attempt=0 attempt=0
max_attempts=20 max_attempts=20
if [ "${DB_ENGINE}" != 'django.db.backends.sqlite3' ]; then
while pg_isready --host=${POSTGRES_HOST} -q; status=$?; attempt=$((attempt+1)); [ $status -ne 0 ] && [ $attempt -le $max_attempts ]; do while pg_isready --host=${POSTGRES_HOST} -q; status=$?; attempt=$((attempt+1)); [ $status -ne 0 ] && [ $attempt -le $max_attempts ]; do
sleep 5 sleep 5
done done
fi
if [ $attempt -gt $max_attempts ]; then if [ $attempt -gt $max_attempts ]; then
echo -e "\nDatabase not reachable. Maximum attempts exceeded." echo -e "\nDatabase not reachable. Maximum attempts exceeded."
@ -45,8 +47,6 @@ if [ "${DB_ENGINE}" != 'django.db.backends.sqlite3' ]; then
echo "Database is ready" echo "Database is ready"
fi
echo "Migrating database" echo "Migrating database"