fix(rpa): 将 Crane 报表等待默认超时延长至 10 分钟

应对 Scheduled Reports 排队超过 5 分钟导致导出失败。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
hugoandCursor committed 2026-09-07 18:29:22 +08:00
1 parent 83da5f326d
commit e40743871c
2 files changed
+5 -3

No files matched your search

@@ -962,10 +962,11 @@ def _wait_and_click_scheduled_download(
轮询 Scheduled Reports 直至目标行 Download 列由 Submitted 变为 Download 并点击。
核心逻辑:每 2s 探测一次状态;每 10s goto 刷新列表;表格可见时不重登,避免闪回登录页;
expect_download 超时且已配置 download_dir 时,短窗口扫描目录新文件兜底。
等待上限由 SHIPPING_NOTICE_RPA_WORKER_CRANE_SCHEDULED_REPORT_WAIT_MS 控制(默认 600000=10 分钟)。
Args:
page: Playwright 页面。
env: 环境变量读取函数。
env: 环境变量读取函数(Windows RPA Worker 进程环境)。
browser_timeout_ms: 浏览器操作超时(亦用于 expect_download)。
description: Schedule 时写入的 Description,用于定位行。
expected_report_name: 期望的 Name 列文件名。
@@ -976,7 +977,8 @@ def _wait_and_click_scheduled_download(
Playwright Download 或 FilesystemDownloadArtifact。
"""
entry = entry_url or _default_crane_entry_url(None)
wait_ms = int(env("SHIPPING_NOTICE_RPA_WORKER_CRANE_SCHEDULED_REPORT_WAIT_MS", "300000") or "300000")
# 默认 10 分钟:Crane 偶发 Submitted 排队 >5 分钟(见 2026-09-03 ~262s / 2026-09-07 满 300s 失败)
wait_ms = int(env("SHIPPING_NOTICE_RPA_WORKER_CRANE_SCHEDULED_REPORT_WAIT_MS", "600000") or "600000")
deadline = time.monotonic() + (wait_ms / 1000)
poll_seconds = float(env("SHIPPING_NOTICE_RPA_WORKER_CRANE_SCHEDULED_REPORT_POLL_SECONDS", "2") or "2")
list_refresh_seconds = float(