fix: 独享账号额度耗尽后安全换号 - #4
Merged
Merged
Conversation
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.
独享用户遇到明确额度耗尽或账号失效后,旧逻辑会将用户留在故障账号直到一小时结束。现在在安全执行边界原子换到同组未占用账号,保留原到期时间,并最多追加一次执行循环内的换号重试。
通用 429、过载和请求策略错误不换号。其他并发请求与被丢弃的流生产者仍在运行时保留旧账号占用,下一次请求再尝试。已输出内容的流不重放。换号更新租约 ID 并保守禁止剩余租期内的 previous_response_id 续接,要求完整历史以避免跨账号错接。管理面板继续兼容 v1.22.2-cpa.21。
验证:相关租约测试 -race、go test ./...、服务构建、真实管理 API 冒烟均通过。包含三种执行模式换号、普通 429 固定账号、并发排空、占用/跨组排除、旧快照拒绝、落盘失败回滚与流式已提交不重放。未更新线上服务。