mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-02 01:10:23 +08:00
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:
@@ -87,6 +87,14 @@ pub fn build_provider_oauth_batch_task_status_payload(
|
||||
"processed": state.get("processed").and_then(serde_json::Value::as_i64).unwrap_or(0),
|
||||
"success": state.get("success").and_then(serde_json::Value::as_i64).unwrap_or(0),
|
||||
"failed": state.get("failed").and_then(serde_json::Value::as_i64).unwrap_or(0),
|
||||
"created_count": state
|
||||
.get("created_count")
|
||||
.and_then(serde_json::Value::as_i64)
|
||||
.unwrap_or(0),
|
||||
"replaced_count": state
|
||||
.get("replaced_count")
|
||||
.and_then(serde_json::Value::as_i64)
|
||||
.unwrap_or(0),
|
||||
"progress_percent": state
|
||||
.get("progress_percent")
|
||||
.and_then(serde_json::Value::as_i64)
|
||||
@@ -154,6 +162,8 @@ mod tests {
|
||||
"processed": 2,
|
||||
"success": 1,
|
||||
"failed": 1,
|
||||
"created_count": 0,
|
||||
"replaced_count": 1,
|
||||
"progress_percent": 999,
|
||||
"error_samples": [
|
||||
{"detail": "x"},
|
||||
@@ -180,6 +190,14 @@ mod tests {
|
||||
payload.get("progress_percent").and_then(|v| v.as_i64()),
|
||||
Some(100)
|
||||
);
|
||||
assert_eq!(
|
||||
payload.get("created_count").and_then(|v| v.as_i64()),
|
||||
Some(0)
|
||||
);
|
||||
assert_eq!(
|
||||
payload.get("replaced_count").and_then(|v| v.as_i64()),
|
||||
Some(1)
|
||||
);
|
||||
assert_eq!(
|
||||
payload
|
||||
.get("error_samples")
|
||||
|
||||
Reference in New Issue
Block a user