From 1369fed6429d1beea8a30256647e4a916927d9f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E8=BF=9B?= Date: Sun, 25 Oct 2026 23:39:25 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B4=A6=E6=88=B7=E9=99=90=E6=B5=81?= =?UTF-8?q?=E9=A2=84=E7=AE=97=E5=B0=8F=E4=BA=8E=E5=8D=95=E5=8D=A1=E8=B0=83?= =?UTF-8?q?=E7=94=A8=E6=95=B0=E6=97=B6=E5=8D=A1=E6=B0=B8=E8=BF=9C=E9=A2=86?= =?UTF-8?q?=E4=B8=8D=E5=88=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 领取脚本在一张卡同组到期调用数大于剩余预算时停止领取,账户 QPS 很小或长期接近上限时,同时到期多项的卡会一直排不上,整个账户停止轮询。改为本轮该组尚未占用且预算大于 0 时至少放行一张,超出部分由网关限流等待模式排队;预算为 0 时仍不领取。 --- internal/polling/carrierqueue/scripts.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/polling/carrierqueue/scripts.go b/internal/polling/carrierqueue/scripts.go index 7b6fb236..7aa9586a 100644 --- a/internal/polling/carrierqueue/scripts.go +++ b/internal/polling/carrierqueue/scripts.go @@ -60,7 +60,10 @@ local function tryClaim(cardId, fromPriority, qkey) end end for g, n in pairs(need) do - if budget[g] ~= nil and (used[g] or 0) + n > budget[g] then + -- 本轮该组尚未占用且预算大于 0 时至少放行一张卡:否则一张卡的调用数大于预算(如账户 1 QPS、卡同时到期 3 项)时永远领不到; + -- 超出部分由网关限流等待模式在调用时排队。 + local u = used[g] or 0 + if budget[g] ~= nil and (budget[g] <= 0 or (u > 0 and u + n > budget[g])) then stop = true return false end