perf(worker): 提交后发送准入唤醒通知

将准入登记、派发、释放、恢复和验收清理中的 PostgreSQL NOTIFY 从同步复制业务事务移到提交后的独立异步提交事务,避免数据库对象锁串行阻塞跨城事务。通知继续作为有轮询兜底的限时提示,不改变任务状态、租约和账务的同步提交语义。

验证:Go 全量测试、go vet、迁移安全检查、gofmt、diff check 通过;新增集成回归确认 NOTIFY 对象锁存在时准入状态仍先提交可见。
This commit is contained in:
2026-07-31 09:56:47 +08:00
parent 580f84f569
commit 447e7ed701
5 changed files with 118 additions and 39 deletions
+3 -5
View File
@@ -286,14 +286,12 @@ SELECT count(*)::bigint
FROM deleted`, staleAfter.String(), limit).Scan(&yielded); err != nil {
return 0, err
}
if yielded > 0 {
if _, err := tx.Exec(ctx, `SELECT pg_notify('gateway_task_admission', '*')`); err != nil {
return 0, err
}
}
if err := tx.Commit(ctx); err != nil {
return 0, err
}
if yielded > 0 {
s.notifyTaskAdmissionBestEffort(ctx, "*")
}
return yielded, nil
}