fix(bioflow): 部署加固——生信服务 SSE 路由入编译白名单(断流崩溃根治同款)+bff_restart 杀进程按端口精确(防误杀 8098)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-09-06 06:54:45 +08:00
co-authored by Claude Fable 5
parent 485e844160
commit 3cf44b4a61
2 changed files with 12 additions and 2 deletions
+4
View File
@@ -45,6 +45,10 @@ WHITELIST_PY=(
"app/config.py"
"app/schemas.py"
"app/db.py"
# SSE 流式路由(TL 2026-09-06 补)——与 sdk 侧断流崩溃根治同款教训:
# 客户端中途断开时 Cython 协程取消断言会 abort 整个进程,明文走 CPython 原生协程
"app/routers/bioflow.py"
"app/routers/biojobs.py"
)
_is_whitelisted() {
local rel="$1"
+8 -2
View File
@@ -10,8 +10,14 @@ PYTHON="/home/xzq/5090/teamWorkspace/zh/plantai-rag-new-venv/bin/python"
BIND="${1:-127.0.0.1}"
[[ -x "$PYTHON" ]] || { echo "BFF Python 不可执行: $PYTHON" >&2; exit 1; }
# 杀旧进程([u] 正则技巧防 pkill 自匹配)
pkill -f "[a]pp.main:app" 2>/dev/null
# 杀旧进程:按 8090 端口精确匹配(TL 2026-09-06 修——
# 旧 pkill 模式 "app.main:app" 会误杀 8098 生信服务,两者同为 uvicorn app.main:app)
if command -v lsof >/dev/null 2>&1; then
OLD_PID="$(lsof -ti tcp:8090 2>/dev/null || true)"
[ -n "$OLD_PID" ] && kill "$OLD_PID" 2>/dev/null || true
else
pkill -f "[a]pp.main:app.*--port 8090" 2>/dev/null || true
fi
sleep 2
cd "$SDK_ROOT"