perf(worker): 解耦异步等待登记与跨城提交

媒体突发中的等待准入行是已同步持久化任务的可恢复派生状态,却逐条等待跨城同步提交并串行占用全局容量锁。\n\n仅对异步等待登记事务设置 synchronous_commit=off;任务实体、素材、执行准入、River job、租约、状态与账务继续同步提交。主备切换若命中极小窗口,由既有 queued-task 恢复器重建等待登记。\n\n验证:临时 PostgreSQL 18 跨 Store 分布式准入集成测试通过;Go 全量测试、go vet、gofmt 通过。
This commit is contained in:
2026-07-31 08:49:37 +08:00
parent a34a508140
commit 1e12522f0c
@@ -151,6 +151,16 @@ func (s *Store) queueTaskAdmissionOnce(
return TaskAdmission{}, err
}
defer rollbackTransaction(tx)
// The task itself was synchronously committed before this derived FIFO
// registration. Do not serialize a large media burst on one cross-region
// synchronous commit per waiting row: PostgreSQL still writes this WAL
// locally, and generic queued-task recovery reconstructs a registration
// after failover if the small asynchronous-commit window is hit. Admission,
// River job, execution lease, task state, and billing commits stay fully
// synchronous.
if _, err := tx.Exec(ctx, `SET LOCAL synchronous_commit = off`); err != nil {
return TaskAdmission{}, err
}
if err := tryAdmissionTransactionLock(ctx, tx, "task-admission:"+input.TaskID); err != nil {
return TaskAdmission{}, err