fix(api): separate traffic readiness from worker health (#604)

Expose /readyz for the runtime snapshot, PostgreSQL, and Redis. Keep worker and logging diagnostics on /healthz so a maintenance failure can alert without removing a serving instance from service discovery.

Co-authored-by: Zyy <zyycn@users.noreply.github.com>
Co-authored-by: Codex <noreply@openai.com>
This commit is contained in:
Zyy
2026-11-04 19:29:50 +08:00
committed by GitHub
co-authored by Zyy Codex
parent 19ef484969
commit 13374e2a70
9 changed files with 136 additions and 40 deletions
+4 -1
View File
@@ -203,7 +203,10 @@ Dashboard 的 `lastUsedRelative` 和账号额度的 `refreshedAtRelative` 由后
| 方法 | 路由 | 鉴权 | 说明 |
| --- | --- | --- | --- |
| `GET` | `/healthz` | 无 | Core、Store 和后台任务健康时返回 `204`,否则返回 `503` |
| `GET` | `/readyz` | 无 | 流量就绪检查。运行时快照可用且 PostgreSQL、Redis 探针健康时返回 `204`,否则返回 `503` |
| `GET` | `/healthz` | 无 | 综合健康检查。在就绪依赖之外检查文件日志和关键后台任务,全部健康时返回 `204`,否则返回 `503` |
两个接口均返回空正文。探针并行执行,共用 2 秒截止时间
## 3. OpenAI 数据面与模型目录
+2 -1
View File
@@ -1216,7 +1216,8 @@ Admin worker 复用连接测试,按凭据及冻结代次比较后解除或顺
### 启动与关闭
启动只有在配置、PostgreSQL、Redis、Provider、Core、Admin、API 和 Worker 全部初始化成功后才进入服务。
健康检查综合 Core、Store 与 Worker 状态,但不会把单个 Provider 的业务降级等同于整个进程失活。
Core 与 Store 在各自的探针上声明接收请求所需的依赖。API 的就绪检查只运行这些探针,
综合健康检查另纳入 Host 文件日志与关键 Worker 状态,并记录故障变化。
客户端下载解析由 Host 的 `ClientDistributionResolver` 实现,组合根注入 Admin;只在管理员请求时访问外部来源,
不阻塞启动。失败时使用官方稳定地址,临时直链不持久化或代理下载,字段与来源规则见 [客户端下载 API](api.md#windows-客户端下载)