优化部分代码

This commit is contained in:
chuzhongzai 2023-12-20 23:21:13 +08:00
parent a188d82a7a
commit 1e0b1c6297
5 changed files with 27 additions and 27 deletions

View File

@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.0</version>
<version>3.1.5</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.lion</groupId>
@ -28,7 +28,7 @@
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>3.0.2</version>
<version>3.0.3</version>
</dependency>
<dependency>
@ -50,7 +50,7 @@
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter-test</artifactId>
<version>3.0.2</version>
<version>3.0.3</version>
<scope>test</scope>
</dependency>
<dependency>

View File

@ -431,11 +431,14 @@ public class CommunicateService {
DynamicConfigMessage dynamicConfigMessage = new DynamicConfigMessage();
dynamicConfigMessage.removeIp(id.get());
dynamicConfigNotify(dynamicConfigMessage);
ips.remove(id.get());
Site site = siteMapper.selectSiteById(id.get());
//删除服务器后服务器下线的场景这时已从mapper删除
if(site == null)
return;
webSocketService.statusAlter(site.getHostname(), false);
siteMapper.updateLastOnlineTime(id.get(), new Date());
ips.remove(id.get());
}
}
}

View File

@ -59,16 +59,13 @@ public class IoUtil {
globalMemory = OshiUtil.getMemory();
for (NetworkIF nif : networkIFs)
if(SystemUtil.getOsInfo().isLinux()) {
if (nif.getName().equals("eth0") || nif.getName().equals("ens3"))
networkIF = nif;
if (nif.getName().startsWith("eth") || nif.getName().startsWith("ens")) {
networkIF = nif;
break;
}
else
if(nif.getName().equals("ethernet_32769"))
networkIF = nif;
if(networkIF == null)
log.error("网卡 eth0 不存在");
log.error("网卡 不存在");
else{
send = networkIF.getBytesSent();
receive = networkIF.getBytesRecv();

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long