refactor(p0-5): 收敛热度相关注释
背景叙述与历史取舍已写进 `docs/design/hot-ranking.md`,从源码删除。 只保留不变式与安全约束:`clientFoundRows` 禁令、唯一索引判重、 成员补零的排序约定、快照用 `RENAMENX` 只建一次、`EXPIRE` 失败即删键。 `video_service.go` 的 `NewVideoService` 注释原本复述已删方法的来历,一并收敛。 `zset.go` 的 `ZUnionStore` 与 `RenameNX` 注释各压到四行以内。 验证:go build ./... 通过。 验证:go vet ./... 通过。 验证:go test -count=1 ./... 全绿(本机无 cgo,未跑 -race)。 验证:go test -tags integration -p 1 -count=1 ./internal/feed/ ./internal/video/ ./internal/worker/ 全绿。
This commit is contained in:
@@ -42,10 +42,7 @@ func NewCommentService(store CommentStore, videos videoExister, cache *rediscach
|
||||
}
|
||||
}
|
||||
|
||||
// Publish 先入队,入队失败才直写。
|
||||
//
|
||||
// 热度不再单独发布:它只由"这次插入是否真的落库"驱动,所以两条轨不会
|
||||
// 各自成功一半。
|
||||
// Publish 先入队,入队失败才直写;热度只由"这次插入是否真的落库"驱动。
|
||||
func (s *CommentService) Publish(ctx context.Context, comment *Comment) error {
|
||||
if comment == nil {
|
||||
return errors.New("comment is nil")
|
||||
@@ -69,7 +66,7 @@ func (s *CommentService) Publish(ctx context.Context, comment *Comment) error {
|
||||
return fmt.Errorf("%w: video not found", apierror.ErrValidation)
|
||||
}
|
||||
|
||||
// 行时间只在"直写"分支用到;worker 分支用它自己消息里的 occurred_at。
|
||||
// 行时间只在直写分支用到;worker 用消息里的 occurred_at。
|
||||
comment.CreatedAt = time.Now().UTC()
|
||||
|
||||
commentEnqueued := false
|
||||
|
||||
Reference in New Issue
Block a user