perf(全链路): 连接池/事务边界/轮询与 IO 效率收口
Java: - LLM 180s 读超时不再被全局 call-timeout 静默截断成 90s(长思考请求被掐断→重试→付费网关二次计费) - 代理 HttpClient 缓存改有界 LRU(jikip 每次提取新 IP,无界缓存持续泄漏 selector 线程与连接池) - 12 个 service 的 Redis 任务锁移出 @Transactional(自旋最坏 10s 白占 DB 连接,池仅 30),远端对象删/传改 afterCommit - 结果文件 Job 闸门拒绝时不再回退内联执行(改重新入队,避免把背压转嫁给 MQ 消费线程) - imagevideo 每秒扫描加列投影、过期清理加 LIMIT;权限页整表查询改列投影(不再拉回密码哈希) - 哈希改 HexFormat;补 5 处"不能改"的技术依据注释(批量插入会丢回填主键、流式丢模板与图片等) 前端:4 个工具页轮询改轻量端点(带 fallback);PriceTrack 快照节流写盘;候选店铺表分页;页面隐藏时停表 客户端:HTTP 连接池按出口复用(Session 仍每请求新建,保持无跨请求状态);品牌检测 WIPO 逐请求握手; 代理配置按 mtime 缓存;串行任务改专属池;异常降级为标签页重连;紫鸟启动改端口轮询;模板编译缓存; 日志上报连接与落盘收口;Flask 版本 API 改按请求复用连接
This commit is contained in:
@@ -194,23 +194,29 @@ async function pollOnce() {
|
||||
for (const key of Object.keys(lineProgressMap.value)) {
|
||||
if (!busy.some((b) => String(b.id) === key)) delete lineProgressMap.value[key]
|
||||
}
|
||||
for (const item of busy) {
|
||||
const id = Number(item.id)
|
||||
if (!id) continue
|
||||
try {
|
||||
const res = await getBrandTask(id)
|
||||
const lp = res?.line_progress
|
||||
if (lp?.has_progress && lp.info) {
|
||||
lineProgressMap.value[String(id)] = {
|
||||
current: Number(lp.info.current_line) || 0,
|
||||
total: Number(lp.info.total_lines) || 0,
|
||||
phase: lp.info.phase,
|
||||
}
|
||||
} else {
|
||||
delete lineProgressMap.value[String(id)]
|
||||
// 并发拉取:此前在 for 循环里逐个 await,任务多时一轮耗时随任务数线性叠加
|
||||
//(brand 模块没有批量进度端点,见 shared/api/endpoints.ts,只能逐个查,故用并发而非 batch)
|
||||
const busyIds = busy.map((item) => Number(item.id)).filter((id) => Number.isFinite(id) && id > 0)
|
||||
const details = await Promise.all(
|
||||
busyIds.map(async (id) => {
|
||||
try {
|
||||
return { id, res: await getBrandTask(id) }
|
||||
} catch {
|
||||
// 单条详情失败不中断整轮轮询
|
||||
return { id, res: null }
|
||||
}
|
||||
} catch {
|
||||
// 单条详情失败不中断整轮轮询
|
||||
}),
|
||||
)
|
||||
for (const { id, res } of details) {
|
||||
const lp = res?.line_progress
|
||||
if (lp?.has_progress && lp.info) {
|
||||
lineProgressMap.value[String(id)] = {
|
||||
current: Number(lp.info.current_line) || 0,
|
||||
total: Number(lp.info.total_lines) || 0,
|
||||
phase: lp.info.phase,
|
||||
}
|
||||
} else {
|
||||
delete lineProgressMap.value[String(id)]
|
||||
}
|
||||
}
|
||||
scheduleNextPoll()
|
||||
|
||||
Reference in New Issue
Block a user