generated from root/miduo_server
自动开服修改
parent
f87c54842f
commit
ab4f7563a5
|
@ -38,6 +38,9 @@ public class AutoServerManager {
|
|||
|
||||
private static final long TIME = DateUtil.ONE_MINUTE*3;
|
||||
|
||||
public static final String REGISTER = "1";
|
||||
public static final String AUTOTIME = "2";
|
||||
|
||||
@Resource
|
||||
private ServerInfoDao serverInfoDao;
|
||||
|
||||
|
@ -71,7 +74,7 @@ public class AutoServerManager {
|
|||
AutoServerSetting setting = RedisUtil.getInstence().getMapValue(RedisUserKey.AUTO_START_SERVER_SETTING, "1", "1", AutoServerSetting.class, -1);
|
||||
LOGGER.info("自动开服配置:{}",setting.toString());
|
||||
// 注册人数
|
||||
if ("1".equals(setting.getChoose())) {
|
||||
if (REGISTER.equals(setting.getChoose())) {
|
||||
// 注册人数3分钟检查一次
|
||||
if (now >= (date + TIME)){
|
||||
// 获取服务器id
|
||||
|
@ -83,9 +86,11 @@ public class AutoServerManager {
|
|||
startServers(newServer);
|
||||
}
|
||||
}
|
||||
// 更新时间
|
||||
date = now;
|
||||
}
|
||||
// 时间开服,每分钟
|
||||
else if ("2".equals(setting.getChoose())){
|
||||
else if (AUTOTIME.equals(setting.getChoose())){
|
||||
// 比较时间是否一致,精确到分
|
||||
boolean compareTime = DateUtil.compareTime(setting.getTime());
|
||||
LOGGER.info("自动开服,时间判断,条件值:{},当前时间:{},结果:{}",setting.getTime(),DateUtil.nowString(),compareTime);
|
||||
|
@ -93,8 +98,6 @@ public class AutoServerManager {
|
|||
startServers(newServer);
|
||||
}
|
||||
}
|
||||
// 更新时间
|
||||
date = now;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue