Repository navigation
feat(actions): 强制终止实例(kill)+ 停止是异步的 - #2
Merged
Merged
Conversation
面板的「停止」是**异步**的:`/stop` 立即返回 200,实例随后进 `STOPPING`,服务器读完档才退出。
存档很大 / 插件死锁 / JVM 假死时会一直停在 `STOPPING` —— 那时唯一的出路是强杀,而本包之前没封装。
新增 `GET /api/protected_instance/kill`(operationId `killInstance`):
- 官方 apidoc 已收录(`api_instance.md` 的 `GET /api/protected_instance/kill`),
`check-apidoc-drift.sh` 是 `[ok]`,不需要进白名单;
- 面板侧 `router.all` + 前端用 GET;内部转发守护进程 `instance/kill` → `execPreset("kill")`,
面板超时 `INSTANCE_KILL_TIMEOUT = 30000`(30 秒,比其它动作长);
- 权限与其它 `protected_instance` 端点一致:**普通用户也能调**(只要实例属于你)。
两处 spec 说明同步修正:
- `/stop` 的描述原来写「要强制杀进程用 `kill`(本包未封装)」→ 现在已封装,并补上
「停止是异步的,可能长时间停在 `STOPPING`」这个关键事实;
- `/kill` 的 200 **不声明响应体**:面板回的是 `{status,data,time}` 外壳,`data` 结构各版本不一致
(10.18.0 实测是 `{instanceUuid}`),声明具体 schema 会因多/少字段解码失败
(踩过:`typeMismatch String/dictionary`)。我们只关心"有没有被拒绝"(403/500)。
顺带:YAML 描述里含 `{ … }` 必须加引号,否则被当成 flow mapping,`openapi-generator` 直接报
`mapping values are not allowed in this context`。
测试:`lifecycleActionsCarryDaemonAndInstance` 覆盖 open/stop/restart/**kill** 的路径与查询参数。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
面板的「停止」是异步的:
/stop立即返回 200,实例随后进STOPPING,服务器读完档才退出。存档很大 / 插件死锁 / JVM 假死时会一直停在STOPPING—— 那时唯一的出路是强杀,而本包之前没封装(spec 里甚至写着"本包未封装")。新增
GET /api/protected_instance/kill(operationIdkillInstance):api_instance.md的GET /api/protected_instance/kill)→check-apidoc-drift.sh输出[ok],不进白名单;router.all+ 前端用 GET;内部转发守护进程instance/kill→execPreset("kill"),面板超时INSTANCE_KILL_TIMEOUT = 30000(30 秒,比其它动作长);protected_instance端点一致:普通用户也能调。spec 同步修正
/stop描述原来写「要强制杀进程用kill(本包未封装)」→ 已封装,并补上「停止是异步的,可能长时间停在STOPPING」;/kill的 200 不声明响应体:面板回{status,data,time}外壳,data各版本不一致(10.18.0 是{instanceUuid}),声明具体 schema 会解码失败(踩过typeMismatch String/dictionary)。只关心有没有被拒绝(403/500)。坑
YAML 描述含
{ … }必须加引号 —— 否则被当 flow mapping,生成器报mapping values are not allowed in this context。验证
swift test:21 + 20 绿;lifecycleActionsCarryDaemonAndInstance覆盖 open/stop/restart/kill 的路径与查询参数;scripts/check-apidoc-drift.sh全[ok]。