fix(freight-rpa): 两域超时放宽至 1 小时并强制收料重试完整重导航
- 库存/收料超时 900s 放宽到 3600s:对账按笔间静默判活后,超时须覆盖最坏批次总时长,防健康在飞批次被误回收(RUN20261008003113B726 实测教训) - 收料 worker 重试尝试(attempt>1)强制完整重导航:对齐库存 AWSRTM 兜底,报表导出菜单缺失属瞬态故障,须回入口页重选菜单,绝不在错误页直接重试 - 凭据校验类失败(invalid/verification)为确定性失败,不进入重试 - 同步 test 环境超时配置
This commit is contained in:
1 parent
9adb3ec077
commit
e8d9dba8a3
2 files changed
+23
-6
No files matched your search
@@ -490,17 +490,25 @@ def _export_unit_download(
|
||||
page: Any,
|
||||
context: Any,
|
||||
drop_dir: Path,
|
||||
attempt: int = 1,
|
||||
) -> tuple[Any, Any]:
|
||||
"""
|
||||
导出单个收料单元的 Playwright Download;必要时干净页重试会话。
|
||||
|
||||
Args:
|
||||
attempt: 第几次尝试(1 起)。>1 时强制完整重导航(对齐库存 2026-09-20 AWSRTM
|
||||
兜底:报表页导出菜单缺失属瞬态故障,绝不在错误页上直接重试,须回入口页
|
||||
重选菜单进报表),且 prepare 的导航/会话类异常一并走干净页安全网
|
||||
(凭据校验类 invalid/verification 为确定性失败,不重试)。
|
||||
Returns:
|
||||
(download, page):download 为 Playwright Download;page 可能已切换为干净页。
|
||||
"""
|
||||
unit['__download_dir'] = str(drop_dir)
|
||||
if connector == 'dbs':
|
||||
source = receipt_dbs_export.build_receipt_dsv_source(unit, entry_url=login_url)
|
||||
previous_unit = group[index - 1] if index > 0 else None
|
||||
# 重试尝试强制完整重导航:不携带前一单元上下文,prepare 从入口页重选菜单进报表。
|
||||
force_full_navigation = attempt > 1
|
||||
previous_unit = group[index - 1] if (index > 0 and not force_full_navigation) else None
|
||||
previous_source = (
|
||||
receipt_dbs_export.build_receipt_dsv_source(previous_unit, entry_url=login_url)
|
||||
if previous_unit is not None else None
|
||||
@@ -509,14 +517,18 @@ def _export_unit_download(
|
||||
try:
|
||||
skip_navigation = bool(
|
||||
dsv_report_export.prepare_dsv_batch_export_step(
|
||||
page, login_url, previous_source, source, index=index,
|
||||
page, login_url, previous_source, source,
|
||||
index=0 if force_full_navigation else index,
|
||||
)
|
||||
)
|
||||
except Exception as exc:
|
||||
if not _is_login_session_error(exc):
|
||||
# 安全网:登录/会话与导航类瞬态异常均新开干净页重跑完整准备;
|
||||
# 仅凭据校验类(invalid/verification)确定性失败不重试(对齐库存)。
|
||||
message = str(exc).lower()
|
||||
if any(token in message for token in ('invalid', 'verification')):
|
||||
raise
|
||||
print(
|
||||
f'[receipt-batch] dbs session prepare failed for {unit.get("source_code")}, '
|
||||
f'[receipt-batch] dbs prepare failed for {unit.get("source_code")}, '
|
||||
f'retry with clean page: {exc}',
|
||||
file=_sys.stderr,
|
||||
)
|
||||
@@ -531,7 +543,8 @@ def _export_unit_download(
|
||||
)
|
||||
return download, page
|
||||
|
||||
first_in_profile = index == 0
|
||||
# Crane 重试尝试同样强制完整重登导航(first_in_profile=True 走首源完整登录)。
|
||||
first_in_profile = index == 0 or attempt > 1
|
||||
try:
|
||||
download = receipt_crane_export.export_receipt_report(
|
||||
page, unit, env=env, browser_timeout_ms=browser_timeout_ms(),
|
||||
@@ -643,6 +656,7 @@ def _process_units(body: dict[str, Any], drop_dir: Path) -> None:
|
||||
page=page,
|
||||
context=context,
|
||||
drop_dir=drop_dir,
|
||||
attempt=attempt,
|
||||
)
|
||||
output = _save_download(
|
||||
download, drop_dir, unit, batch_run_no=batch_run_no,
|
||||
|
||||
Reference in new issue
Block a user