fix: 每轮点3个+等待180秒,避免队列堆积

红点检测不准(失败任务红点持续存在),改为:
- 每轮只点3个(而不是6个),给队列留余量
- 等待时间从120秒增加到180秒
- 超时后直接滚动,靠下游MD5去重兜底
This commit is contained in:
yuming
2026-09-18 22:55:12 +08:00
parent dd4d5571e2
commit 8a934c8813
+2 -13
View File
@@ -575,7 +575,7 @@ def get_remote_new_file_count(baseline_files):
return len(all_files - baseline_files) return len(all_files - baseline_files)
def tap_all_thumbnails(baseline, max_rounds=300, poll_interval=4, max_wait_per_round=120): def tap_all_thumbnails(baseline, max_rounds=300, poll_interval=4, max_wait_per_round=180):
"""循环:点击固定网格 9 个卡片(点击即下载)→ 轮询确认下载数量稳定 → 滚动 2 行。 """循环:点击固定网格 9 个卡片(点击即下载)→ 轮询确认下载数量稳定 → 滚动 2 行。
新版 UI(7.8.1)自绘,dump 拿不到缩略图 bounds,改用固定网格坐标 THUMB_X x THUMB_Y。 新版 UI(7.8.1)自绘,dump 拿不到缩略图 bounds,改用固定网格坐标 THUMB_X x THUMB_Y。
首次点击卡片会弹"使用手机网络下载将消耗流量"确认框,点确定后补点一次该卡片。 首次点击卡片会弹"使用手机网络下载将消耗流量"确认框,点确定后补点一次该卡片。
@@ -720,17 +720,6 @@ def tap_all_thumbnails(baseline, max_rounds=300, poll_interval=4, max_wait_per_r
# 每屏动态实测卡片行中心 y(消除整点分组标签平移造成的错位,这是"重复下载" # 每屏动态实测卡片行中心 y(消除整点分组标签平移造成的错位,这是"重复下载"
# 的总根源),再对每行 × 固定 3 列逐格判打勾,只点还没下载完的。 # 的总根源),再对每行 × 固定 3 列逐格判打勾,只点还没下载完的。
grid_shot = screenshot("/tmp/_gridchk.png") grid_shot = screenshot("/tmp/_gridchk.png")
# 队列忙等待:右上角有红点说明下载队列已满,新点击会被拒绝。
# 先等队列消化(最多5分钟),红点消失后再继续,避免空等6分钟后滚动走。
queue_wait = 0
while is_queue_busy(grid_shot) and queue_wait < 300:
if queue_wait % 30 == 0:
print(f" 轮 {r+1}: 下载队列忙(右上角红点),等待队列消化... {queue_wait}s")
time.sleep(10)
queue_wait += 10
grid_shot = screenshot("/tmp/_gridchk.png")
if is_queue_busy(grid_shot):
print(f" 轮 {r+1}: 等待 {queue_wait}s 后队列仍忙,照常滚动(靠下游去重兜底)")
full_rows = detect_card_rows(grid_shot) full_rows = detect_card_rows(grid_shot)
# 检测不到行时重试最多3次:缩略图加载慢、ANR刚恢复、画面切换中都会导致 # 检测不到行时重试最多3次:缩略图加载慢、ANR刚恢复、画面切换中都会导致
# 临时检测不到行。之前只重试1次就放弃,会误判"全部已打勾"直接滚动, # 临时检测不到行。之前只重试1次就放弃,会误判"全部已打勾"直接滚动,
@@ -758,7 +747,7 @@ def tap_all_thumbnails(baseline, max_rounds=300, poll_interval=4, max_wait_per_r
badge_skipped = sum(1 for cy in row_centers for gx in THUMB_X if checked.get((gx, cy))) badge_skipped = sum(1 for cy in row_centers for gx in THUMB_X if checked.get((gx, cy)))
# 收集所有未打勾格子(从上到下),最多9个避免超并发 # 收集所有未打勾格子(从上到下),最多9个避免超并发
todo_cells = [(gx, cy) for cy in row_centers for gx in THUMB_X if not checked.get((gx, cy))] todo_cells = [(gx, cy) for cy in row_centers for gx in THUMB_X if not checked.get((gx, cy))]
tapped_cells = todo_cells[:6] # 萤石并发上限10,留余量点6个 tapped_cells = todo_cells[:3] # 每轮只点3个,避免队列堆积
for (gx, cy) in tapped_cells: for (gx, cy) in tapped_cells:
adb("shell", "input", "tap", str(gx), str(cy)) adb("shell", "input", "tap", str(gx), str(cy))
time.sleep(0.5) time.sleep(0.5)