feat(client): GET 请求瞬态故障自动重试(指数退避),非幂等方法不重试 #339
Loading…
Reference in New Issue
No description provided.
Delete Branch "Taoyouce/gitlink-cli:feat/get-retry-backoff"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
背景
CLI 目前对任何网络抖动(连接失败、网关 502/503/504、限流 429)都直接失败。在 AI Agent / CI 门禁等自动化场景下,一次瞬态故障就会中断整条工作流。成熟 CLI(如 gh)默认对幂等请求做有限次重试。
变更内容
internal/client:GET(幂等)请求遇到以下瞬态故障自动重试,最多 2 次,指数退避(300ms → 600ms):--debug下打印每次重试的原因与退避时长。测试
internal/client/retry_test.go5 个用例:503 两次后成功、超过重试上限停止、POST 不重试、404 不重试、连接拒绝重试后报错。go test ./.../go vet/gofmt全绿。repo +info正常。Step 1:
From your project repository, check out a new branch and test the changes.Step 2:
Merge the changes and update on Gitea.