mirror of
https://github.com/ThearchyHelios/AgentLab.git
synced 2026-11-22 13:02:00 +00:00
check-catalog、check-catalog-loop:关页面之前先撤掉拦截、忽略还在路上的那几条,取真实设置的拦截在页面关掉之后才回来时不再把检查进程带崩(满负荷并行时偶发「Request context disposed」)
This commit is contained in:
@@ -96,7 +96,13 @@ async function open(path, { handlers = [], viewport = { width: 1440, height: 900
|
||||
await page.goto(`${WEB}${path}`, { waitUntil: 'networkidle' })
|
||||
await page.evaluate((t) => document.documentElement.setAttribute('data-theme', t), THEME)
|
||||
await page.waitForTimeout(400)
|
||||
return { page, sent, errors, natives, close: () => { opened.delete(ctx); return ctx.close() } }
|
||||
// 关之前先撤掉拦截、忽略还在路上的那几条:满负荷并行时,取真实返回的拦截可能在页面关掉之后才回来,
|
||||
// 没人接住的报错会把整个检查进程带崩(「Request context disposed」)
|
||||
return { page, sent, errors, natives, close: async () => {
|
||||
opened.delete(ctx)
|
||||
await page.unrouteAll({ behavior: 'ignoreErrors' }).catch(() => {})
|
||||
return ctx.close()
|
||||
} }
|
||||
}
|
||||
const goto = async (page, path) => {
|
||||
await page.goto(`${WEB}${path}`, { waitUntil: 'networkidle' })
|
||||
|
||||
Reference in New Issue
Block a user