refactor(fudai): 拆出 _handle_in_fudai_detail 详情为None早返回(3687→3663,-24 行)
handle_detail_is_none:detail==None 时清除任务数量标志 + 写完成日志 + 早返回。 新增 3 个单元测试,1068 → 1071 用例全过。 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
18c6f7b025
commit
b6cd3ac8a3
3 files changed
+70
-26
No files matched your search
@@ -3304,32 +3304,8 @@ class fudai_analyse:
|
||||
step4_start = time.time()
|
||||
# 执行参与决策
|
||||
if detail is None:
|
||||
try:
|
||||
self._log_kv("参与", "详情数据为 None,无法执行参与决策")
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
# 清除任务数量标志
|
||||
try:
|
||||
self._fudai_detail_task_count_from_stage = None
|
||||
try:
|
||||
self._log_kv(
|
||||
"福袋详情",
|
||||
"_handle_in_fudai_detail:清除任务数量标志",
|
||||
log_type="DEBUG",
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
elapsed = time.time() - start_time
|
||||
self._log_kv(
|
||||
"流程",
|
||||
"_handle_in_fudai_detail完成(详情为None)",
|
||||
elapsed_seconds=round(elapsed, 2),
|
||||
)
|
||||
return
|
||||
if fudai_detail_blocks.handle_detail_is_none(self, start_time):
|
||||
return
|
||||
join_result = douyin_fudai_core.basic_join_decision(
|
||||
self, detail, (skip, skip_reason)
|
||||
)
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import time
|
||||
from typing import Any
|
||||
|
||||
|
||||
@@ -68,3 +69,38 @@ def handle_too_many_consecutive_failures(
|
||||
except Exception:
|
||||
pass
|
||||
return True
|
||||
|
||||
|
||||
def handle_detail_is_none(analyser: Any, start_time: float) -> bool:
|
||||
"""步骤4 入口:detail 为 None 时清除任务数量标志并提前 return。
|
||||
|
||||
返回 True 表示已处理 None 分支,主流程应 return。
|
||||
"""
|
||||
try:
|
||||
analyser._log_kv("参与", "详情数据为 None,无法执行参与决策")
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
analyser._fudai_detail_task_count_from_stage = None
|
||||
try:
|
||||
analyser._log_kv(
|
||||
"福袋详情",
|
||||
"_handle_in_fudai_detail:清除任务数量标志",
|
||||
log_type="DEBUG",
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
try:
|
||||
elapsed = time.time() - start_time
|
||||
analyser._log_kv(
|
||||
"流程",
|
||||
"_handle_in_fudai_detail完成(详情为None)",
|
||||
elapsed_seconds=round(elapsed, 2),
|
||||
)
|
||||
except Exception:
|
||||
pass
|
||||
return True
|
||||
Reference in new issue
Block a user