improve: 使用调度状态接口做健康检查

- 将 Bioyond 启动健康检查从物料类型列表切换为 scheduler_status()。
- 避免 debug 日志输出完整物料类型列表。
- 保持连接监控响应更轻量、更易读。
This commit is contained in:
yxz321
2026-05-21 15:59:17 +08:00
parent 212f9ec448
commit a084031af0

View File

@@ -56,13 +56,17 @@ class ConnectionMonitor:
def _monitor_loop(self): def _monitor_loop(self):
while self._running: while self._running:
try: try:
# 使用 lightweight API 检查连接 # 使用轻量级调度状态接口检查连接,避免启动时打印完整物料类型列表。
# query_matial_type_list 是比较快的查询 result = self.workstation.hardware_interface.scheduler_status()
start_time = time.time()
result = self.workstation.hardware_interface.material_type_list()
status = "online" if result else "offline" status = "online" if result else "offline"
msg = "Connection established" if status == "online" else "Failed to get material type list" if status == "online":
msg = (
f"Scheduler status={result.get('status')}, "
f"hasTask={result.get('hasTask')}"
)
else:
msg = "Failed to get scheduler status"
if status != self._last_status: if status != self._last_status:
logger.info(f"Bioyond连接状态变更: {self._last_status} -> {status}") logger.info(f"Bioyond连接状态变更: {self._last_status} -> {status}")