fix(queue): 隔离异步准入故障并持久化退避
将 X-Async 调度改为逐任务阻塞协议,区分全局容量、平台容量、用户组 FIFO、任务级异常和系统级故障,避免单个历史毒任务触发整批回滚。\n\n新增持久化退避、单任务 CAS 重选、幂等终态事务、固定标签指标和损坏快照自愈,并修复 Worker 从 preparing 直接进入 finalizing 时的自等待死锁。\n\n验证:API 全量测试、PostgreSQL 集成场景、race、go vet、govulncheck、pnpm lint/test/build、Compose 与发布脚本测试通过;pnpm audit 命中未改动的 Nx 工具链既有漏洞。
This commit is contained in:
@@ -62,6 +62,13 @@ func TestMetricsExposeBoundedOutcomesAndState(t *testing.T) {
|
||||
metrics.ObserveConcurrencyLeaseRenewal("lost")
|
||||
metrics.ObserveTaskEventSkip("duplicate")
|
||||
metrics.ObserveTaskEventSkip("budget_exceeded")
|
||||
metrics.ObserveAsyncAdmissionDispatch("admitted")
|
||||
metrics.ObserveAsyncAdmissionDispatch("global_wait")
|
||||
metrics.ObserveAsyncAdmissionDispatch("reselect")
|
||||
metrics.ObserveAsyncAdmissionDispatch("deferred")
|
||||
metrics.ObserveAsyncAdmissionDispatch("terminal")
|
||||
metrics.ObserveAsyncAdmissionDispatch("task_error")
|
||||
metrics.ObserveAsyncAdmissionDispatch("system_error")
|
||||
|
||||
recorder := httptest.NewRecorder()
|
||||
metrics.Handler(metricsSnapshot{
|
||||
@@ -116,6 +123,13 @@ func TestMetricsExposeBoundedOutcomesAndState(t *testing.T) {
|
||||
`easyai_gateway_concurrency_lease_renewals_total{outcome="lost"} 1`,
|
||||
`easyai_gateway_task_events_skipped_total{outcome="duplicate"} 1`,
|
||||
`easyai_gateway_task_events_skipped_total{outcome="budget_exceeded"} 1`,
|
||||
`easyai_gateway_async_admission_dispatch_total{outcome="admitted"} 1`,
|
||||
`easyai_gateway_async_admission_dispatch_total{outcome="global_wait"} 1`,
|
||||
`easyai_gateway_async_admission_dispatch_total{outcome="reselect"} 1`,
|
||||
`easyai_gateway_async_admission_dispatch_total{outcome="deferred"} 1`,
|
||||
`easyai_gateway_async_admission_dispatch_total{outcome="terminal"} 1`,
|
||||
`easyai_gateway_async_admission_dispatch_total{outcome="task_error"} 1`,
|
||||
`easyai_gateway_async_admission_dispatch_total{outcome="system_error"} 1`,
|
||||
`easyai_gateway_postgres_pool_max_connections 32`,
|
||||
`easyai_gateway_postgres_pool_total_connections 18`,
|
||||
`easyai_gateway_postgres_pool_acquired_connections 12`,
|
||||
|
||||
Reference in New Issue
Block a user