From 3a31fa476855bf78fd2da46f2644518f403ccfc6 Mon Sep 17 00:00:00 2001 From: song Date: Wed, 21 Jan 2026 11:50:38 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20429=20=E9=99=90=E6=B5=81=E6=97=B6?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=B4=A6=E5=8F=B7=20last=5Fused=5Fat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 在设置限流标记时同时更新 last_used_at,使得刚触发 429 的账号 在后续调度中优先级降低,让其他账号有更多被选中的机会。 --- backend/internal/repository/account_repo.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/backend/internal/repository/account_repo.go b/backend/internal/repository/account_repo.go index 6fcb5290..440223eb 100644 --- a/backend/internal/repository/account_repo.go +++ b/backend/internal/repository/account_repo.go @@ -787,6 +787,7 @@ func (r *accountRepository) SetRateLimited(ctx context.Context, id int64, resetA Where(dbaccount.IDEQ(id)). SetRateLimitedAt(now). SetRateLimitResetAt(resetAt). + SetLastUsedAt(now). Save(ctx) if err != nil { return err @@ -812,7 +813,7 @@ func (r *accountRepository) SetAntigravityQuotaScopeLimit(ctx context.Context, i client := clientFromContext(ctx, r.client) result, err := client.ExecContext( ctx, - "UPDATE accounts SET extra = jsonb_set(COALESCE(extra, '{}'::jsonb), $1::text[], $2::jsonb, true), updated_at = NOW() WHERE id = $3 AND deleted_at IS NULL", + "UPDATE accounts SET extra = jsonb_set(COALESCE(extra, '{}'::jsonb), $1::text[], $2::jsonb, true), updated_at = NOW(), last_used_at = NOW() WHERE id = $3 AND deleted_at IS NULL", path, raw, id,