修复任务卡死与安能启动失败
- runtime.py: launch_anneng 拉起前清除 NODE_OPTIONS,避免 Electron 因 --use-system-ca 启动即退出(rc=9) - server.py: POST /tasks 在 worker 未就绪时返回 409 拦截误操作;worker 就绪后调用 fail_stale_tasks 实现重启自愈 - state_store.py: 新增 fail_stale_tasks(),将遗留 pending/running 任务标记为 failed
This commit is contained in:
@@ -107,9 +107,14 @@ def _wait_cdp_up(port, timeout=60.0):
|
||||
|
||||
def launch_anneng(app_path):
|
||||
"""以调试模式启动安能 Electron 应用(自动选取空闲端口),返回子进程对象。"""
|
||||
# 【环境兼容】WorkBuddy 等 shell 会注入 NODE_OPTIONS(含 --use-system-ca),
|
||||
# Electron 内置 Node 拒绝该 flag 导致安能启动即退出(rc=9)。
|
||||
# 拉起前从子进程环境里摘掉 NODE_OPTIONS。
|
||||
anneng_env = os.environ.copy()
|
||||
anneng_env.pop("NODE_OPTIONS", None)
|
||||
port = _find_free_port()
|
||||
print(f">> 以调试模式启动【安能】应用(端口 {port}):{app_path}")
|
||||
proc = subprocess.Popen([app_path, f"--remote-debugging-port={port}"])
|
||||
proc = subprocess.Popen([app_path, f"--remote-debugging-port={port}"], env=anneng_env)
|
||||
site_anneng.set_cdp_port(port)
|
||||
if not _wait_cdp_up(port):
|
||||
raise RuntimeError(
|
||||
|
||||
Reference in New Issue
Block a user