1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

test: more efficient database ready detection

This commit is contained in:
Steven Tang
2022-12-27 15:35:11 +11:00
parent ad704cef5c
commit 03af194385
2 changed files with 15 additions and 9 deletions

View File

@@ -47,11 +47,20 @@ case $1 in
else
config="config.$1.yml"
fi
sleep 5
if [ "$1" == "mysql" ]; then
sleep 10
db_port=0
if [ "$1" == "postgres" ]; then
db_port=5432
else
db_port=3306
fi
for _ in $(seq 0 30); do
if netstat -tulpn 2>/dev/null | grep "LISTEN" | tr -s ' ' | cut -d' ' -f4 | grep -E ":$db_port$" > /dev/null; then
break
fi
sleep 1
done
;;
sqlite|*)