修复未加入房间,恢复可用机器人数

master
zhouwei 2026-01-26 17:23:17 +08:00
parent 552620e486
commit dda674af58
1 changed files with 5 additions and 1 deletions

View File

@ -171,8 +171,9 @@ public class RoomWanfaMatcher {
//检查调度器是否可用
if (!scheduler.isShutdown()) {
CompletableFuture.runAsync(() -> {
RobotInfo robot = null;
try {
RobotInfo robot = robotManager.getLoggedInRobotForWanfa(wanfaId);
robot = robotManager.getLoggedInRobotForWanfa(wanfaId);
//加入房间
GroupRoomBusiness.joinRoom(group, roomId, robot.getSession(), null);
@ -185,6 +186,9 @@ public class RoomWanfaMatcher {
robotConnectionHandler.readyTimeRobotExit(robot);
}
} catch (Exception e) {
if (robot != null) {
robotConnectionHandler.disconnectRobot(robot.getRobotId());
}
log.error("机器人加入房间时发生错误: groupId={}, roomId={}, wanfaId={}, isRobot={}", group, roomId, wanfaId, isRobot, e);
}
});