From 381288e70774661bfac8fb841e844d652a803cfa Mon Sep 17 00:00:00 2001 From: wangjia <809946525@qq.com> Date: Fri, 10 Jul 2026 13:56:03 +0800 Subject: [PATCH] =?UTF-8?q?docs(v2):=20Router.Pick=20=E6=B3=A8=E6=98=8E=20?= =?UTF-8?q?weighted=20=E6=A1=B6=E5=BA=8F=E7=BB=91=E5=AE=9A=20config=20?= =?UTF-8?q?=E8=B4=A6=E6=88=B7=E5=A3=B0=E6=98=8E=E9=A1=BA=E5=BA=8F(reorder?= =?UTF-8?q?=3Drepin)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/accounts/router.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/internal/accounts/router.go b/internal/accounts/router.go index 618db12..42a923a 100644 --- a/internal/accounts/router.go +++ b/internal/accounts/router.go @@ -37,6 +37,9 @@ func (r *Router) strategyFor(channel string) Strategy { } // Pick 实现 accounts.Picker。 +// 注:cands 顺序 = EnabledFor 保留的 config.Accounts 声明顺序,原样传给策略—— +// weighted 的桶按候选顺序累加边界(见 weighted.go),故 config.yaml 里账户顺序变了 +// 等价于重新分桶(reorder = repin),同一 OutTradeNo 命中的账户可能跟着变,不是 bug。 func (r *Router) Pick(channel, region string, hint PickHint) (config.AccountConfig, error) { cands := r.reg.EnabledFor(channel, region) if len(cands) == 0 {