style(backend): 清理幂等写入路径的注释

注释只保留一行级约束。
长段理由移入设计文档。
验证:go test -count=1 ./... 全绿。
This commit is contained in:
2026-10-31 00:03:53 +08:00
parent c0ab69118a
commit c210e75996
13 changed files with 50 additions and 239 deletions

View File

@@ -62,7 +62,7 @@ func (w *CommentWorker) applyPublish(ctx context.Context, evt *rabbitmq.CommentE
return err
}
if !ok {
// 视频已被删除:没有可落评论的地方,但这是"处理完了",不是失败。
// 视频已删除:处理完了,不是失败。
return nil
}
@@ -72,8 +72,7 @@ func (w *CommentWorker) applyPublish(ctx context.Context, evt *rabbitmq.CommentE
AuthorID: evt.AuthorID,
Content: strings.TrimSpace(evt.Content),
}
// 事件里的 event_id 就是"这次用户意图"的键。API 侧若已经兜底直写过,
// 这次插入会命中唯一索引:(created=false) 说明重复投递,热度不能再加一次。
// event_id 即意图键:API 已直写时这里会命中唯一索引。
if evt.EventID != "" {
key := evt.EventID
c.IdempotencyKey = &key