perf(F5+): 行数据按需拉取(结果行版本信号)+ 修复 progress/light 恒判 missing
行数据按需拉取(审查 F5 后续): - V125 给 biz_file_result 补 updated_at(DEFAULT/ON UPDATE 由数据库维护, 实体标注 insertStrategy/updateStrategy=NEVER —— 否则 selectById→updateById 的 写回会把旧值写回去、ON UPDATE 不触发,版本信号静默冻结) - 装配器回传 rowsVersion=「最后变更时间毫秒#行数」,5 个品牌工具页版本未变即跳过 带行明细的重型 batch;前端变更信号为 rowsVersion + status/fileStatus/fileReady 复合 (任务收尾常见「行早写完、之后才置成功」,只看行版本会把界面卡在旧状态) 修复线上缺陷(同一功能验证时暴露): - TaskProgressLightAssembler 列裁剪漏选 module_type 却用它做模块过滤 → getModuleType() 恒为 null → light 恒把任务判成 missing;第七批把 light 接进 跟价/定时匹配/商品风险的轮询后,消费方会把运行中任务判为 FAILED - 补选中列 + 守卫用例 taskQueryMustSelectModuleType(已反向验证:去掉修复即红) - 前端 lightClaimsAllTasksMissing:整体性 missing 结论用重型端点复核后再采信 契约与文档:light 白名单补 rowsVersion(Java 契约测试 / spec 06 §2 / 12 个端点描述) 测试:mvn test 2901 全绿;前端 npm test 765 全绿
This commit is contained in:
@@ -267,6 +267,8 @@ import { useHistoryPolling } from '@/shared/composables/useHistoryPolling'
|
||||
import { runBatchDelete } from '@/shared/utils/batch-delete'
|
||||
import { isRecordMissingError, parseTaskStartTimes, removeTaskStartTime, upsertTaskStartTime } from '@/shared/utils/task-queue-state.ts'
|
||||
import { useTablePaging } from '@/shared/composables/useTablePaging.ts'
|
||||
import { getModuleProgressLight } from '@/shared/api/progress-light.ts'
|
||||
import { createRowsVersionTracker } from '@/shared/api/task-progress-polling.ts'
|
||||
|
||||
const MAX_TRANSIENT_ERRORS = 30;
|
||||
const ziniaoVersion = useZiniaoVersion();
|
||||
@@ -829,6 +831,9 @@ function mergeHistoryProgressItems(incoming: WithdrawHistoryItem[]) {
|
||||
historyItems.value = merged;
|
||||
}
|
||||
|
||||
/** 结果行版本跟踪:版本未变的任务不再拉取行明细(F5 后续) */
|
||||
const rowsVersionTracker = createRowsVersionTracker()
|
||||
|
||||
async function refreshActiveTaskProgress(taskIds?: number[]) {
|
||||
const ids = Array.from(
|
||||
new Set(
|
||||
@@ -841,9 +846,28 @@ async function refreshActiveTaskProgress(taskIds?: number[]) {
|
||||
if (!ids.length) {
|
||||
return;
|
||||
}
|
||||
const batch = await getWithdrawTaskProgressBatch(ids);
|
||||
// 行数据按需拉取(审查 F5 后续):先问轻量端点拿"结果行版本",版本未变的任务跳过重型 batch
|
||||
let heavyIds = ids;
|
||||
let missingIds: number[] = [];
|
||||
try {
|
||||
const light = await getModuleProgressLight('withdraw', ids);
|
||||
heavyIds = rowsVersionTracker.selectTasksNeedingRows(light.items || [], ids);
|
||||
missingIds = light.missingTaskIds || [];
|
||||
if (!heavyIds.length) {
|
||||
if (missingIds.length) {
|
||||
await loadHistory();
|
||||
reconcileActiveQueueTaskWithHistory();
|
||||
}
|
||||
return;
|
||||
}
|
||||
} catch {
|
||||
// 轻量端点不可用(老后端/网络)→ 照旧全量拉取,行为与原来一致
|
||||
heavyIds = ids;
|
||||
}
|
||||
const batch = await getWithdrawTaskProgressBatch(heavyIds);
|
||||
missingIds = Array.from(new Set([...missingIds, ...(batch.missingTaskIds || [])]));
|
||||
mergeHistoryProgressItems(batch.items || []);
|
||||
if ((batch.missingTaskIds || []).length) {
|
||||
if (missingIds.length) {
|
||||
await loadHistory();
|
||||
reconcileActiveQueueTaskWithHistory();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user