diff --git a/scripts/rpa/README.md b/scripts/rpa/README.md index 99ff11e4..6d5f444b 100644 --- a/scripts/rpa/README.md +++ b/scripts/rpa/README.md @@ -1691,7 +1691,7 @@ Worker 按 `worker_connector_type + rpa_profile_code` 分组,确保同一 conn | `SHIPPING_NOTICE_RPA_WORKER_CRANE_SUBMISSION_COMPLETE_WAIT_MS` | 等待 Report Submitted 提示消失的最长时间(默认 120000) | | `SHIPPING_NOTICE_RPA_WORKER_CRANE_SCHEDULED_TABLE_SELECTOR` | Scheduled Reports 表格行选择器 | | `SHIPPING_NOTICE_RPA_WORKER_CRANE_SCHEDULED_REPORT_NAME` | Scheduled Reports 目标文件名(Name 列,默认 `OnHandDetails.xlsx`) | -| `SHIPPING_NOTICE_RPA_WORKER_CRANE_SCHEDULED_REPORT_WAIT_MS` | 等待列表行 Submitted→Download 的最长时间(默认 300000) | +| `SHIPPING_NOTICE_RPA_WORKER_CRANE_SCHEDULED_REPORT_WAIT_MS` | 等待列表行 Submitted→Download 的最长时间(默认 **600000**=10 分钟) | | `SHIPPING_NOTICE_RPA_WORKER_CRANE_SCHEDULED_REPORT_POLL_SECONDS` | 轮询 Scheduled Reports 间隔秒数(默认 3) | | `SHIPPING_NOTICE_RPA_WORKER_CRANE_SCHEDULED_REPORTS_URL` | Scheduled Reports 页面 URL(默认由当前站点 hash 推导) | | `SHIPPING_NOTICE_RPA_WORKER_CRANE_OWNER_SELECTOR` | Crane Owner 下拉/输入(可选) | diff --git a/scripts/rpa/connectors/crane/crane_report_export.py b/scripts/rpa/connectors/crane/crane_report_export.py index 99bbaab5..b9bca63c 100644 --- a/scripts/rpa/connectors/crane/crane_report_export.py +++ b/scripts/rpa/connectors/crane/crane_report_export.py @@ -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(