From ec5cc4c2065cbc9a248b8471e01693f7132d042c Mon Sep 17 00:00:00 2001 From: xiaoxia Date: Wed, 9 Sep 2026 18:27:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20Worker=20health=20check=20=E6=89=AB?= =?UTF-8?q?=E6=8F=8F=E5=85=A8=E9=83=A8=20/proc=20=E8=BF=9B=E7=A8=8B?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20unhealthy=20=E8=AF=AF=E5=88=A4=20+=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20PanelTitleConfig.tsx=20TS=20=E7=BC=96?= =?UTF-8?q?=E8=AF=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1. Worker health check 修复: - 原 healthcheck 使用 pgrep 和 PID 1 检查,但容器内无 pgrep/ps - 部署脚本中 sh -c 嵌套引号导致 $pid 变量提前展开为空 - 改用 grep -lq celery /proc/[0-9]*/cmdline 扫描所有进程 - 影响文件:compose.yml, deploy-staging-registry.sh, deploy-production-registry.sh 2. TypeScript 编译错误修复: - 移除 PanelTitleConfig.tsx 中未使用的导入和变量 - 移除:useEffect, TitleLibraryAutoComplete, TitleOption, getTitles, TextArea, Input - showTitleLibrary 状态改为 _showTitleLibrary(设置但未读取) --- .../pages/ai-avatar/components/PanelTitleConfig.tsx | 10 ++-------- infra/docker/compose.yml | 4 ++-- infra/docker/deploy-production-registry.sh | 2 +- infra/docker/deploy-staging-registry.sh | 2 +- 4 files changed, 6 insertions(+), 12 deletions(-) diff --git a/apps/web/src/pages/ai-avatar/components/PanelTitleConfig.tsx b/apps/web/src/pages/ai-avatar/components/PanelTitleConfig.tsx index 5411d7efa..6ddc0b77c 100644 --- a/apps/web/src/pages/ai-avatar/components/PanelTitleConfig.tsx +++ b/apps/web/src/pages/ai-avatar/components/PanelTitleConfig.tsx @@ -7,11 +7,8 @@ * - AiAvatarTitleConfig ↔ TitleSettings 的双向适配 * - 自动生成字幕开关 */ -import React, { useMemo, useState, useEffect } from "react" -import { Input } from "antd" +import React, { useMemo, useState } from "react" import TitleStylePanel from "@/pages/generate/components/title/TitleStylePanel" -import TitleLibraryAutoComplete from "@/pages/generate/components/title/TitleLibraryAutoComplete" -import type { TitleOption } from "@/pages/generate/components/title/TitleLibraryAutoComplete" import type { TitleSettings } from "@/pages/generate/types" import { POSITION_OPTIONS, @@ -20,9 +17,6 @@ import { getFontFamily, } from "@/pages/generate/constants" import type { AiAvatarTitleConfig } from "../types" -import { getTitles } from "@/api/titles" - -const { TextArea } = Input interface PanelTitleConfigProps { titleConfig: AiAvatarTitleConfig @@ -66,7 +60,7 @@ const PanelTitleConfig: React.FC = ({ titleConfig, onUpda }) } - const [showTitleLibrary, setShowTitleLibrary] = useState(false) + const [_showTitleLibrary, setShowTitleLibrary] = useState(false) return (
diff --git a/infra/docker/compose.yml b/infra/docker/compose.yml index b0ce86443..46bfc0e74 100755 --- a/infra/docker/compose.yml +++ b/infra/docker/compose.yml @@ -128,9 +128,9 @@ services: - xiaoxia-net # 健康检查配置 - # 注:celery inspect ping 依赖 broker 连接,在容器内不可靠,改用进程检查 + # 注:容器内无 pgrep/ps,扫描 /proc 所有进程的 cmdline 查找 celery 进程 healthcheck: - test: ["CMD-SHELL", "for pid in /proc/[0-9]*/cmdline; do if grep -ql celery \"$pid\" 2>/dev/null; then exit 0; fi; done; exit 1"] + test: ["CMD-SHELL", "grep -lq celery /proc/[0-9]*/cmdline 2>/dev/null || exit 1"] interval: 30s timeout: 10s retries: 3 diff --git a/infra/docker/deploy-production-registry.sh b/infra/docker/deploy-production-registry.sh index e9a4a6a27..c0a78f05f 100755 --- a/infra/docker/deploy-production-registry.sh +++ b/infra/docker/deploy-production-registry.sh @@ -155,7 +155,7 @@ docker run -d \ --restart unless-stopped \ --cpus 2 \ --memory 2g \ - --health-cmd "sh -c \"for pid in /proc/[0-9]*/cmdline; do if grep -ql celery \"$pid\" 2>/dev/null; then exit 0; fi; done; exit 1\"" \ + --health-cmd "sh -c \"grep -lq celery /proc/[0-9]*/cmdline 2>/dev/null || exit 1\"" \ --health-interval 30s \ --health-timeout 10s \ --health-retries 3 \ diff --git a/infra/docker/deploy-staging-registry.sh b/infra/docker/deploy-staging-registry.sh index e7494c9b3..c5441d9f9 100755 --- a/infra/docker/deploy-staging-registry.sh +++ b/infra/docker/deploy-staging-registry.sh @@ -116,7 +116,7 @@ docker run -d \ -v "$GENERATED_DIR:/app/generated" \ --restart unless-stopped \ --label com.centurylinklabs.watchtower.enable=true \ - --health-cmd "sh -c \"for pid in /proc/[0-9]*/cmdline; do if grep -ql celery \"$pid\" 2>/dev/null; then exit 0; fi; done; exit 1\"" \ + --health-cmd "sh -c \"grep -lq celery /proc/[0-9]*/cmdline 2>/dev/null || exit 1\"" \ --health-interval 30s \ --health-timeout 10s \ --health-retries 3 \