feat(runtime): 服务模式任务执行不再激活浏览器窗口
网页站点(顺心/百世/中通/韵达)执行下载流程时不再把浏览器窗口置顶,避免打扰用户当前工作;流程在后台静默跑。启动登录阶段与交互模式不受影响。 - RuntimeContext 加 foreground 标志:True=任务执行时置顶(交互调试),False=后台静默(服务模式) - launch_and_prepare(foreground=True) 透传;server worker 以 foreground=False 启动 - _web_handler 按 ctx.foreground 决定单 page 置顶;顺心(list) 透传给 shunxin_download - shunxin 两个 download 加 foreground 参数,逐账号 bring_to_front 加条件 - 启动登录/初始弹窗清理的 bring_to_front 不变(启动时窗口需可见) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -58,7 +58,7 @@ scheduler = BackgroundScheduler(daemon=True)
|
||||
def _worker_loop():
|
||||
"""worker 线程:启动 Playwright + 等就绪 + 任务循环(执行任务 + 心跳)。"""
|
||||
try:
|
||||
ctx = launch_and_prepare()
|
||||
ctx = launch_and_prepare(foreground=False)
|
||||
worker_state["ctx"] = ctx
|
||||
worker_state["ready"] = True
|
||||
# 【P1-2 重启自愈】worker 就绪后清理上轮遗留的 pending/running 僵尸任务
|
||||
|
||||
Reference in New Issue
Block a user