Repository navigation
fix: 亲和渠道失败后从最高优先级回退 (#152) - #162
Merged
Merged
Conversation
…Nous#8078) (cherry picked from commit fcc241c)
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.
🔗 关联任务 / Related Issue
Closes #152
上游:QuantumNous/new-api@fcc241c(QuantumNous#8078)
🚀 变更类型 / Type of change
📝 变更描述 / Description
原样 cherry-pick 上游修复。亲和渠道消耗一次请求尝试,但不消耗普通优先级层级;首次失败回退从最高优先级开始,跨组时清除偏移,保持原有重试预算和严格会话行为。只改三个授权文件,保留 fork 插件路由实现。
本 PR 由 Codex AI 辅助移植与验证,交由独立 reviewer 审核。已核对 git 身份 woncc 与近期核心提交历史一致。
📸 运行证明 / Proof of Work
基线生产代码搭配新增回归用例执行:
GOMAXPROCS=2 RAYON_NUM_THREADS=2 GOWORK=off go test -p=2 ./controller/ -run '^TestChannelAffinityRetryPriorities$/^sqlite$/cache=false/^affinity_hit$' -count=1 -v,按预期失败:实际渠道序列[27,27,30],预期[27,24,27]。修复候选执行:
结果:controller、service 均 PASS;亲和优先级 54 场景全部通过,未跳过数据库。SQLite 3.50.4、MySQL 8.0.46、PostgreSQL 15.19;MySQL/PostgreSQL 使用测试夹具创建的独立数据库,测试后删除,仅复用现有本地引擎。连接参数经环境变量注入,不包含在正文中。
git diff --check HEAD^ HEAD通过;三个文件gofmt -l无输出。未运行全量套件,未部署、合并或改动依赖。既有 DB 夹具初始化会输出 options 表尚未创建的日志,断言均通过;基线同样存在该日志。✅ 提交前检查项 / Checklist