Files
ecs-relay-service/deployable/ASYNC_BROKER_UPDATE.md
ex_tianzy 660d7a48d2 feat(tasks): track authenticated native progress until final reply
Renew broker idle waits only for encrypted current-task progress, keep an absolute deadline and binding/session/worker fences, and retain original-message reply deduplication. Add guarded prepare-update staging that reuses the active broker key material and application configuration. Validation: 216 passed, 2 skipped; guarded update and long-task routing covered with synthetic Docker configuration and loopback WebSocket tests. Real ECS build and acceptance remain pending.
2026-11-04 18:12:12 +08:00

29 lines
2.4 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# 已运行 broker 的异步任务更新
适用:现有 connector/router 均健康,且已使用 broker 凭据方案。更新不会生成新密钥或重新授权,不修改数据库卷、权限配置和其他组件。本轮为经过当前身份和任务校验的进度续期,仍有绝对上限;ECS 重启或连接丢失后的任务自动恢复不在本轮范围。
在当前 ECS 执行(输出目录必须尚不存在):
```bash
cd /home/cnooc/ecs-relay-service-staging-http
git pull --ff-only
sudo python3 deployable/scripts/broker_deploy.py prepare-update \
--plan /home/cnooc/hainuo-broker-prepared-20261104 \
--output /home/cnooc/hainuo-broker-update-20261104-async
sudo python3 deployable/scripts/broker_deploy.py build \
--plan /home/cnooc/hainuo-broker-update-20261104-async
sudo python3 deployable/scripts/broker_deploy.py activate \
--plan /home/cnooc/hainuo-broker-update-20261104-async \
--client-v2-ready
sudo python3 deployable/scripts/broker_deploy.py state \
--plan /home/cnooc/hainuo-broker-update-20261104-async
```
一次执行一条,失败先看 state,不重复 activate。不运行原迁移 prepare,也不重新生成 keyring。prepare-update 沿用父计划的同一密钥内容和权限/应用身份,在独立受保护目录内保留更新计划,旧计划不被覆盖。新镜像从当前已确认镜像离线复用依赖;回滚目标为更新前的 broker 镜像。密钥副本和新旧计划目录均需保留且不得外传。
更新工具先验证父计划、关键配置、运行镜像和存储;部分切换会拒绝生成更新。新计划的 rollback 仍要求停止 broker 使用,防止切换期间丢失任务;不恢复数据库或旧 refresh token。回滚只退应用代码,任务执行状态必须另行核对。
更新先于配套客户端安装。老 v2 客户端仍可使用,未发送进度时沿用闲置超时。新客户端以任务 ID 查询原生状态,只有校验通过的加密 progress 才续期闲置等待,最终结果仍按原任务/消息发送一次。默认闲置超时 HN_REQUEST_TIMEOUT=45 秒,绝对上限 HN_TASK_TRACKING_TIMEOUT=1800 秒(允许 30–3600);进度不能无限续期。
验收:授权状态不变;今日日程一次调用正确时间范围;超过原 150 秒的任务最终能回原消息;双用户不串结果;执行中解绑后不再推旧结果。Docker 构建和这些现场行为未在开发机上实测,需在 ECS 执行并核对。