style(backend): 清理消息失败处理路径的注释
注释搬家到 docs/design/message-failure-handling.md。 删除复述代码的注释、历史缺陷说明与批次编号。保留的类型断言、索引语义、声明顺序等约束已在文档中展开。 重写 dlx.go、topology.go、consumer.go 三个文件,其余文件只删注释。 唯一非注释改动是 topology.go 里两处 ExchangeDeclare 由多行压成单行,语义不变。 验证:go test -count=1 ./... 全绿。
This commit is contained in:
@@ -16,14 +16,8 @@ import (
|
||||
|
||||
// BuildDSN 组装 MySQL DSN。
|
||||
//
|
||||
// 抽成函数只是为了让"DSN 里有哪些参数"可被单测钉住——它看起来是纯配置,
|
||||
// 实际上承载着一个正确性前提:**不得开启 clientFoundRows**。
|
||||
//
|
||||
// clientFoundRows 会让 MySQL 在 UPDATE 未改动任何行时也报告 1 行受影响,
|
||||
// 而 P0-4 的判重依赖 RowsAffected==0 来识别"这条意图已经落过库"
|
||||
// (见 video.CommentRepository.CreateIdempotentWithPopularity)。一旦打开,
|
||||
// 重复写入会被当成首次写入,评论去重与热度门控同时静默失效——它不会报错,
|
||||
// 只会悄悄多出一行评论和一份热度。
|
||||
// 不得开启 clientFoundRows:它会让 UPDATE 未改动行时也报告 1 行受影响,
|
||||
// 而判重依赖 RowsAffected==0。
|
||||
func BuildDSN(dbcfg config.DatabaseConfig) string {
|
||||
return fmt.Sprintf("%s:%s@tcp(%s:%d)/%s?charset=utf8mb4&parseTime=True&loc=Local",
|
||||
dbcfg.User, dbcfg.Password, dbcfg.Host, dbcfg.Port, dbcfg.DBName)
|
||||
@@ -43,8 +37,7 @@ func AutoMigrate(db *gorm.DB) error {
|
||||
&account.Account{}, &video.Video{}, &video.Like{}, &video.Comment{},
|
||||
&social.Social{}, &video.OutboxMsg{}, &video.Tag{}, &video.VideoTag{},
|
||||
&message.Message{}, ¬ification.Notification{},
|
||||
// 停泊消息的落库表(P0-3)。它的写入方是 Worker 的 FailedEventWorker,
|
||||
// 但建表仍由 API 进程的 AutoMigrate 统一负责——建表入口只有一个。
|
||||
// 停泊消息的落库表;建表入口只有这一个。
|
||||
&failedevent.FailedEvent{},
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user