20250904-初步功能已完成

This commit is contained in:
2025-09-13 01:03:15 +08:00
parent 6da5926b4b
commit 3f5c880c0f
3 changed files with 83 additions and 81 deletions

View File

@@ -35,7 +35,7 @@ class Deviceinfo(object):
self._port_in_use: set[int] = set() # 正在使用的端口
# 🔥1. 启动 WDA 健康检查线程
threading.Thread(target=self._wda_health_checker, daemon=True).start()
# threading.Thread(target=self._wda_health_checker, daemon=True).start()
# region iproxy 初始化
try:
@@ -128,20 +128,20 @@ class Deviceinfo(object):
time.sleep(1)
# 🔥2. WDA 健康检查
def _wda_health_checker(self):
while True:
time.sleep(1)
print(len(self.deviceModelList))
with self._lock:
online = [m for m in self.deviceModelList if m.ready] # ← 只检查就绪的
print(len(online))
for model in online:
udid = model.deviceId
if not self._wda_ok(udid):
LogManager.warning(f"WDA 异常,重启通道:{udid}", udid)
with self._lock:
self._remove_model(udid)
self.connectDevice(udid)
# def _wda_health_checker(self):
# while True:
# time.sleep(1)
# print(len(self.deviceModelList))
# with self._lock:
# online = [m for m in self.deviceModelList if m.ready] # ← 只检查就绪的
# print(len(online))
# for model in online:
# udid = model.deviceId
# if not self._wda_ok(udid):
# LogManager.warning(f"WDA 异常,重启通道:{udid}", udid)
# with self._lock:
# self._remove_model(udid)
# self.connectDevice(udid)
# 🔥3. 真正做 health-check 的地方
def _wda_ok(self, udid: str) -> bool: