feat(oauth): 允许替换已失效的活跃 OAuth 账号并同步 status_snapshot

- 活跃但 token 已过期或刷新失败的重复账号视为可替换
- 清除失效标记、刷新配额时同步更新 status_snapshot.oauth
- oauth_invalid 清除接口同时识别 invalid_at 与 invalid_reason 两种标记
- 批量导入任务状态区分 created_count / replaced_count,前端据此展示新增/替换统计
- 补充重复替换场景的集成测试,用量测试等待超时从 10s 提升到 30s 以适应并行压力
This commit is contained in:
fawney19
2026-04-20 22:59:02 +08:00
parent cf7d129595
commit c5c56ff92f
15 changed files with 965 additions and 44 deletions

View File

@@ -34,7 +34,9 @@ where
T: UsageReadRepository + ?Sized,
{
let mut stored = None;
let timeout = std::time::Duration::from_secs(10);
// Usage terminal events are written on a shared background runtime; under full-suite parallel
// load they can lag noticeably behind the request/response assertion path.
let timeout = std::time::Duration::from_secs(30);
let deadline = tokio::time::Instant::now() + timeout;
loop {
stored = repository

View File

@@ -458,7 +458,9 @@ where
T: UsageReadRepository + ?Sized,
{
let mut stored = None;
let timeout = std::time::Duration::from_secs(10);
// Usage terminal events are written on a shared background runtime; under full-suite parallel
// load they can lag noticeably behind the request/response assertion path.
let timeout = std::time::Duration::from_secs(30);
let deadline = tokio::time::Instant::now() + timeout;
loop {
stored = repository