fix: launch page.goto uses domcontentloaded to avoid slow-site timeout
launch_and_prepare opened each site with Playwright's default wait_until='load', which waits for every resource (ads/trackers/images). sxne.sxjdfreight.com (顺心) reliably takes >30s to fire load, so its goto timed out and — launch not being retried — killed the whole worker, leaving only one page open. Switch the two launch gotos to wait_until='domcontentloaded' (return as soon as the DOM is ready; the readiness polling still gates login). Behavior for already-fast sites unchanged. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -306,13 +306,15 @@ def launch_and_prepare(debug_mode=False, debug_target=""):
|
|||||||
for acct in range(1, 3):
|
for acct in range(1, 3):
|
||||||
print(f">> 正在启动【顺心】账号{acct}标签页: {url}")
|
print(f">> 正在启动【顺心】账号{acct}标签页: {url}")
|
||||||
sx_page = context.new_page()
|
sx_page = context.new_page()
|
||||||
sx_page.goto(url)
|
# domcontentloaded:DOM 就绪即返回,不等慢资源(广告/图片)的 load 事件,
|
||||||
|
# 避免顺心等站点 load 超 30s 导致整个 worker 启动失败。就绪轮询自会判登录态。
|
||||||
|
sx_page.goto(url, wait_until="domcontentloaded")
|
||||||
sx_pages.append(sx_page)
|
sx_pages.append(sx_page)
|
||||||
pages_map["顺心"] = sx_pages
|
pages_map["顺心"] = sx_pages
|
||||||
else:
|
else:
|
||||||
print(f">> 正在启动【{site_name}】页面: {url}")
|
print(f">> 正在启动【{site_name}】页面: {url}")
|
||||||
page = context.new_page()
|
page = context.new_page()
|
||||||
page.goto(url)
|
page.goto(url, wait_until="domcontentloaded")
|
||||||
pages_map[site_name] = page
|
pages_map[site_name] = page
|
||||||
|
|
||||||
# 4. 安能 Electron
|
# 4. 安能 Electron
|
||||||
|
|||||||
Reference in New Issue
Block a user