Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 9258aa8273 |
+15
-11
@@ -619,6 +619,21 @@ func workerHandlers(store *postgresstore.Store, config appconfig.Config, kbBindi
|
|||||||
}
|
}
|
||||||
handlers["source.scan.pp"] = handler.Handle
|
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() {
|
if !config.TestWeKnoraEnabled || !config.LibraryWorkerRole.ExecutesSourceWork() {
|
||||||
return handlers, nil
|
return handlers, nil
|
||||||
}
|
}
|
||||||
@@ -695,17 +710,6 @@ func workerHandlers(store *postgresstore.Store, config appconfig.Config, kbBindi
|
|||||||
handlers["test.poll"] = poll.Handle
|
handlers["test.poll"] = poll.Handle
|
||||||
handlers["test.validate"] = validate.Handle
|
handlers["test.validate"] = validate.Handle
|
||||||
handlers["test.remove"] = remove.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
|
return handlers, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user