fix: 429 限流时更新账号 last_used_at
在设置限流标记时同时更新 last_used_at,使得刚触发 429 的账号 在后续调度中优先级降低,让其他账号有更多被选中的机会。
This commit is contained in:
@@ -787,6 +787,7 @@ func (r *accountRepository) SetRateLimited(ctx context.Context, id int64, resetA
|
|||||||
Where(dbaccount.IDEQ(id)).
|
Where(dbaccount.IDEQ(id)).
|
||||||
SetRateLimitedAt(now).
|
SetRateLimitedAt(now).
|
||||||
SetRateLimitResetAt(resetAt).
|
SetRateLimitResetAt(resetAt).
|
||||||
|
SetLastUsedAt(now).
|
||||||
Save(ctx)
|
Save(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -812,7 +813,7 @@ func (r *accountRepository) SetAntigravityQuotaScopeLimit(ctx context.Context, i
|
|||||||
client := clientFromContext(ctx, r.client)
|
client := clientFromContext(ctx, r.client)
|
||||||
result, err := client.ExecContext(
|
result, err := client.ExecContext(
|
||||||
ctx,
|
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,
|
path,
|
||||||
raw,
|
raw,
|
||||||
id,
|
id,
|
||||||
|
|||||||
Reference in New Issue
Block a user