fix(deploy): 优化大表迁移并修复后台事件循环

This commit is contained in:
yml
2026-11-20 22:11:54 +08:00
parent 071d45ad1d
commit 409e22be90
7 changed files with 28 additions and 5 deletions
+7 -2
View File
@@ -160,10 +160,13 @@ cmd_deploy() {
echo ""
echo "等待服务启动..."
local startup_timeout="${DEPLOY_STARTUP_TIMEOUT_SECONDS:-1800}"
local max_attempts=$(((startup_timeout + 1) / 2))
echo " 启动超时: ${startup_timeout}s(数据库大表迁移可能持续数分钟)"
# 健康检查
# 30 秒不够:mysql 一起重建时应用就绪约 35 秒,会误报「启动超时」。
for i in $(seq 1 40); do
for i in $(seq 1 "$max_attempts"); do
if curl -s "http://localhost:${APP_PORT}/api/health" | grep -q "ok" 2>/dev/null; then
echo ""
echo "服务已响应,等待 Docker 健康检查..."
@@ -189,7 +192,9 @@ cmd_deploy() {
echo "=============================="
exit 0
fi
echo " 等待中... ($i/40)"
if [ $((i % 15)) -eq 0 ] || [ "$i" = "$max_attempts" ]; then
echo " 等待中... ($i/$max_attempts,已等待 $((i * 2))s)"
fi
sleep 2
done