enqueueRun 用 "job-" + run_id 当 jobs.id,而 jobs.id 是 VARCHAR(36);run_id 本身 已是 36 字符(rec- + 32 位 hex),拼出 40 字符,INSERT 必然失败,批次在 claim 之后 立刻被记成 failed/queue_unavailable——候选库里 19:37 起所有批次都是这个状态,C-101 起的用例全部无法开始。 改为 job 自带 "job-"+32 位 hex 的 id(36 字符),幂等仍由唯一 idempotency_key (reconciliation-run:<run_id>)保证。补单测:CreateRun 入队请求 id 必须正好 36 字符、 type/idempotency_key/payload 与 run 一致。 验证:go test ./internal/reconciliation/ 通过;make verify 17 项 = 16 success + identity skipped。
This commit is contained in:
@@ -214,8 +214,15 @@ func (s *Service) enqueueRun(ctx context.Context, runID string, now time.Time) e
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
// jobs.id is VARCHAR(36) and the run id alone already fills it ("rec-" + 32 hex),
|
||||
// so the job carries its own id; idempotency is guaranteed by the unique
|
||||
// idempotency_key below, not by deriving the id from the run.
|
||||
jobID, err := newID("job-")
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
_, err = s.queue.Enqueue(ctx, jobs.EnqueueRequest{
|
||||
ID: "job-" + runID,
|
||||
ID: jobID,
|
||||
Type: "reconciliation.run",
|
||||
Payload: payload,
|
||||
Priority: 5,
|
||||
|
||||
Reference in New Issue
Block a user