fix: 已删除设备残留失败记录不再出现在异常汇总

- _merge_status 清理不在 STF 设备池且无运行 worker 的陈旧状态
- /api/summary 按当前设备池过滤,STF 异常时不隐藏任何记录
This commit is contained in:
2026-08-09 08:04:57 +08:00
parent 0c4f586ae5
commit 5f914c4fe4
2 changed files with 19 additions and 0 deletions
+10
View File
@@ -723,6 +723,16 @@ class TaskManager:
worker_status = {w["serial"]: w for w in get_all_worker_status()}
running = self.get_running()
# 清理陈旧状态:serial 已不在 STF 设备池、且没有在跑 worker 的条目,
# 避免设备被删除后其失败记录仍残留在"异常汇总"里
present = {dev.get("serial", "") for dev in all_devices}
for serial, w in list(worker_status.items()):
if serial in present or serial in running:
continue
if w.get("status") in ("running", "connecting"):
continue
_remove_worker(serial)
result = []
for dev in all_devices:
serial = dev.get("serial", "")