fix(creator): 强制同步抢锁失败分类提示——租约被占/竞品停用分别返回可读 409
douyin-release-gate / verify (push) Failing after 4m57s

- ClaimCompetitorSync 失败后经 SyncClaimFailure 复查竞品状态,
  区分 ErrSyncInProgress(该竞品正在同步中)与 ErrSyncDisabled(已停用)
- creatorError 新增两分类映射 409;通用冲突文案保持不变
- 前端竞品强制同步去掉固定'强制同步失败'后缀,直接展示分类提示
- 回归:TestCompetitorSyncClaimFailureClassification(PG 集成)
This commit is contained in:
2026-09-29 15:11:23 +08:00
parent a9ac84f459
commit 998871e3c4
6 changed files with 66 additions and 8 deletions
+6 -1
View File
@@ -621,6 +621,10 @@ func creatorError(c fiber.Ctx, err error) error {
case errors.Is(err, accountdomain.ErrNotFound):
// 跨域引用(如账号不存在):account 包哨兵也映射 404,避免 500 掩盖真实语义。
status, message = fiber.StatusNotFound, "resource not found"
case errors.Is(err, creator.ErrSyncInProgress):
status, message = fiber.StatusConflict, creator.ErrSyncInProgress.Error()
case errors.Is(err, creator.ErrSyncDisabled):
status, message = fiber.StatusConflict, creator.ErrSyncDisabled.Error()
case errors.Is(err, creator.ErrConflict):
status, message = fiber.StatusConflict, creator.ErrConflict.Error()
case errors.Is(err, creator.ErrNotFound):
@@ -1291,7 +1295,8 @@ func syncCreatorCompetitorWithClaim(ctx context.Context, store *creator.Store, h
return creator.CollectionReport{}, err
}
if !claimed {
return creator.CollectionReport{}, creator.ErrConflict
// 抢锁失败说明竞品正被其它同步占用或已停用,分类后返回可读的 409 提示。
return creator.CollectionReport{}, store.SyncClaimFailure(ctx, competitorID)
}
// blocked(网关不可用等环境暂不可用)也必须排下一次重试:否则 next_sync_at 置空后定时获取对该账号永久失效。
nextRetry := func() *time.Time {