Skip to content

fix(admin): mark batch refresh 401 failures as error#2943

Open
Luminet2023 wants to merge 2 commits into
Wei-Shaw:mainfrom
Luminet2023:codex/batch-refresh-401-error-status
Open

fix(admin): mark batch refresh 401 failures as error#2943
Luminet2023 wants to merge 2 commits into
Wei-Shaw:mainfrom
Luminet2023:codex/batch-refresh-401-error-status

Conversation

@Luminet2023
Copy link
Copy Markdown

@Luminet2023 Luminet2023 commented Jun 1, 2026

变更

  • batch-refresh 单账号刷新失败后,按错误对应的 HTTP 状态码判断是否需要自动标记账号错误。
  • 仅当刷新错误满足 401 Unauthorized 时调用 AdminService.SetAccountError,由既有仓储逻辑写入 status=errorerror_message 并关闭调度。
  • 保留非 401 失败的原有行为:只返回批量接口的 errors 明细,不修改账号状态。
  • 增加 handler 单元测试覆盖 401、非 401、文本型 HTTP 401 错误识别。

背景

/api/v1/admin/accounts/batch-refresh 原先只汇总刷新失败的账号 ID 和错误信息,不会改变账号状态。现在刷新失败只有在上游语义为 401 时才会自动进入 error 状态,避免临时网络错误、非 OAuth 账号等非授权失败误伤账号。

验证

  • go test -- -tags=unit ./internal/handler/admin -run TestBatchRefresh -count=1
  • go test -- -tags=unit ./internal/handler/admin -count=1

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Jun 1, 2026

All contributors have signed the CLA. ✅
Posted by the CLA Assistant Lite bot.

@Luminet2023
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@Luminet2023 Luminet2023 marked this pull request as ready for review June 1, 2026 05:23
@Luminet2023
Copy link
Copy Markdown
Author

recheck

github-actions Bot added a commit that referenced this pull request Jun 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant