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

@@ -6,12 +6,11 @@ import (
"time"
)
// CommentMQ 通过连接管理器发布评论事件(不再持有长生命周期 channel)。
// CommentMQ 通过连接管理器发布评论事件。
type CommentMQ struct {
mgr *RabbitMQ
}
// 拓扑常量导出:见 likeMQ.go 中的说明。
const (
CommentExchange = "comment.events"
CommentQueue = "comment.events"
@@ -40,9 +39,7 @@ func NewCommentMQ(base *RabbitMQ) (*CommentMQ, error) {
return &CommentMQ{mgr: base}, nil
}
// Publish 直接接收完整事件:event_id 由调用方(服务层)生成,因为它是
// "这次用户意图"的标识,必须与兜底直写用的是同一个值(P0-4 §6.8)。
// 只有 EventID 为空时才在这里补一个随机 id(老调用方/测试路径)。
// Publish 接收完整事件;EventID 由调用方生成,仅为空时补一个随机值。
func (c *CommentMQ) Publish(ctx context.Context, evt CommentEvent) error {
return c.publish(ctx, "publish", CommentPublishRK, evt)
}