Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
陈曦
sub2api
Commits
72961c58
Commit
72961c58
authored
Mar 04, 2026
by
shaw
Browse files
fix: Anthropic 平台无限流重置时间的 429 不再误标记账号限流
parent
a05711a3
Changes
1
Hide whitespace changes
Inline
Side-by-side
backend/internal/service/ratelimit_service.go
View file @
72961c58
...
@@ -676,7 +676,17 @@ func (s *RateLimitService) handle429(ctx context.Context, account *Account, head
...
@@ -676,7 +676,17 @@ func (s *RateLimitService) handle429(ctx context.Context, account *Account, head
}
}
}
}
// 没有重置时间,使用默认5分钟
// Anthropic 平台:没有限流重置时间的 429 可能是非真实限流(如 Extra usage required),
// 不标记账号限流状态,直接透传错误给客户端
if
account
.
Platform
==
PlatformAnthropic
{
slog
.
Warn
(
"rate_limit_429_no_reset_time_skipped"
,
"account_id"
,
account
.
ID
,
"platform"
,
account
.
Platform
,
"reason"
,
"no rate limit reset time in headers, likely not a real rate limit"
)
return
}
// 其他平台:没有重置时间,使用默认5分钟
resetAt
:=
time
.
Now
()
.
Add
(
5
*
time
.
Minute
)
resetAt
:=
time
.
Now
()
.
Add
(
5
*
time
.
Minute
)
slog
.
Warn
(
"rate_limit_no_reset_time"
,
"account_id"
,
account
.
ID
,
"platform"
,
account
.
Platform
,
"using_default"
,
"5m"
)
slog
.
Warn
(
"rate_limit_no_reset_time"
,
"account_id"
,
account
.
ID
,
"platform"
,
account
.
Platform
,
"using_default"
,
"5m"
)
if
err
:=
s
.
accountRepo
.
SetRateLimited
(
ctx
,
account
.
ID
,
resetAt
);
err
!=
nil
{
if
err
:=
s
.
accountRepo
.
SetRateLimited
(
ctx
,
account
.
ID
,
resetAt
);
err
!=
nil
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment