候选(9dddda84)实测:批次能建、入队也成功(jobs 里有 pending 行),但 worker 从不认领——worker_heartbeats.job_types 里根本没有 reconciliation.run。 原因:该 handler 注册在 workerHandlers 的测试库取件块里,而这一块在 !TEST_WEKNORA_ENABLED 时直接 return,于是只开 RECONCILIATION_ENABLED 的候选 只有 API 接线、worker 空转,批次停在 running 直到 6h 僵死回收。 把注册移到那个早退之前:只依赖 reconciliationService(租户 Key 走知识库绑定), 与旧取件/上传链路解耦。
This commit is contained in:
+15
-11
@@ -619,6 +619,21 @@ func workerHandlers(store *postgresstore.Store, config appconfig.Config, kbBindi
|
||||
}
|
||||
handlers["source.scan.pp"] = handler.Handle
|
||||
}
|
||||
// 导入对账的作业处理器只依赖对账服务本身(租户 Key 走知识库绑定),
|
||||
// 与旧测试库取件/上传链路(TEST_WEKNORA_ENABLED)无关,必须在下面那个
|
||||
// 早退之前注册;否则 RECONCILIATION_ENABLED=true 时候选只接线了 API,
|
||||
// worker 从不认领 reconciliation.run,批次永远停在 running。
|
||||
if reconciliationService != nil {
|
||||
handlers["reconciliation.run"] = func(handlerCtx context.Context, job jobs.Job) error {
|
||||
var payload struct {
|
||||
RunID string `json:"run_id"`
|
||||
}
|
||||
if err := json.Unmarshal(job.Payload, &payload); err != nil || payload.RunID == "" {
|
||||
return jobs.Permanent(jobs.ErrCodeHandlerFallback, errors.New("invalid reconciliation run payload"))
|
||||
}
|
||||
return reconciliationService.ExecuteRun(handlerCtx, payload.RunID)
|
||||
}
|
||||
}
|
||||
if !config.TestWeKnoraEnabled || !config.LibraryWorkerRole.ExecutesSourceWork() {
|
||||
return handlers, nil
|
||||
}
|
||||
@@ -695,17 +710,6 @@ func workerHandlers(store *postgresstore.Store, config appconfig.Config, kbBindi
|
||||
handlers["test.poll"] = poll.Handle
|
||||
handlers["test.validate"] = validate.Handle
|
||||
handlers["test.remove"] = remove.Handle
|
||||
if reconciliationService != nil {
|
||||
handlers["reconciliation.run"] = func(handlerCtx context.Context, job jobs.Job) error {
|
||||
var payload struct {
|
||||
RunID string `json:"run_id"`
|
||||
}
|
||||
if err := json.Unmarshal(job.Payload, &payload); err != nil || payload.RunID == "" {
|
||||
return jobs.Permanent(jobs.ErrCodeHandlerFallback, errors.New("invalid reconciliation run payload"))
|
||||
}
|
||||
return reconciliationService.ExecuteRun(handlerCtx, payload.RunID)
|
||||
}
|
||||
}
|
||||
return handlers, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user