Skip to content

Commit d6929df

Browse files
committed
refactor(people): 引入聚类协调器统一管理增量聚类调度
将分散在 peopleService 中的反馈重聚类循环、后台聚类提交、前台互斥 逻辑抽取为独立的 peopleClusteringCoordinator,实现单 worker 串行 执行、优先级调度和前台让步: - 新增 peopleClusteringCoordinator:单 worker goroutine 独占 runIncrementalClustering/protoCache,并发=1 - 调度优先级:前台变更 > 反馈重聚类 > 后台聚类(非抢占) - 前台操作通过 addForegroundWaiter 注册,worker 在每批次前 waitForegroundClear 让步,避免与 merge/split/move/dissolve 冲突 - 反馈重聚类请求合并(coalesce),零结果冷却期间仍允许后台聚类 - submitBackground 阻塞等待结果,并发请求共享同一批次(合并) - 删除旧的 feedbackMu/feedbackRunning/feedbackStopCh 轮询循环, 改用 sync.Cond 驱动的事件通知 - writeGate 获取方式统一为 beginForegroundMutation/ endForegroundMutation,确保 foregroundWaiters 计数在错误路径 和 panic 恢复后正确归零 - ApplyDetectionResult 中 writeGate 精细化:仅写入时持锁,提交 聚类不持锁,防止后台等待 coordinator 时阻塞前台 - MergePeople 新增 writeGateWaitMs/businessMs/totalMs 耗时日志 - AcquireWriteGate 返回的 release 函数改为 sync.Once 保护, 同时注销 foregroundWaiter - 新增 8 项协调器测试:串行化、优先级让步、panic 恢复、 前台计数恢复、protoCache 竞态检测、聚类等价性等
1 parent 8e96c6d commit d6929df

5 files changed

Lines changed: 1028 additions & 265 deletions

File tree

.claude/settings.local.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@
88
"Bash(cd backend && go build -o bin/relive cmd/relive/main.go)",
99
"Bash(go build -o bin/relive cmd/relive/main.go)",
1010
"Bash(cd frontend && npm run build)",
11-
"Bash(npm run build --prefix frontend)"
11+
"Bash(npm run build --prefix frontend)",
12+
"Bash(go build *)",
13+
"Bash(npx vue-tsc *)"
1214
]
1315
},
1416
"permissionMode": "auto",

0 commit comments

Comments
 (0)