Skip to content

feat(cli): add --wait-timeout-sec to configure synchronous poll timeout (#119)#121

Merged
Ali1213 merged 5 commits into
ucloud:masterfrom
Episkey-G:feat/wait-timeout-config
Jul 14, 2026
Merged

feat(cli): add --wait-timeout-sec to configure synchronous poll timeout (#119)#121
Ali1213 merged 5 commits into
ucloud:masterfrom
Episkey-G:feat/wait-timeout-config

Conversation

@Episkey-G

Copy link
Copy Markdown
Collaborator

背景

Fixes #119。同步任务轮询(等待资源到达目标状态,如创建集群/主机)的总超时此前被硬编码为 10 分钟(pkg/cli/poller.go),无法调整,导致耗时 >10min 的同步创建必然超时。

改动

  • pkg/cli:新增包级默认轮询超时 + SetDefaultPollTimeout(d)(忽略非正值,规避 SDK waiter Timeout==0 直接报错的陷阱);NewPoller 读取该默认值。三条 poller 创建路径(ctx.Poller/PollerToprogress.Sspollcmd/api.go repeats poller)均收敛到包级 NewPoller,单点注入即全覆盖。
  • cmd:新增全局 flag --wait-timeout-sec(单位秒,0=用内置默认 600s),与既有 --timeout-sec(单次 HTTP 请求超时)相互独立;启动时注入到 poller。
  • 同时支持 --wait-timeout-sec 1800--wait-timeout-sec=1800 两种写法。

兼容性

默认保持 10 分钟不变,未传 flag 时行为完全不变。

测试

  • pkg/cli:默认值 / 覆盖 / 非正值忽略 单测
  • cmd--wait-timeout-sec 解析 helper 单测(空格 / 等号 / 边界 / 非法值,7 用例)
  • go build / go vet / go test(cmd + pkg/cli)全绿

说明

--wait-timeout-secapplyGlobalOverrideFlags 注册,遵循与现有全局 override flag 一致的排除规则(init/gendoc/config/auth)。

@Ali1213 Ali1213 merged commit aec6daf into ucloud:master Jul 14, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NewPoller default timeout time is 10 Minute

2 participants