feat(sj_1.0.0): 优化代码
This commit is contained in:
parent
dceb6f2714
commit
b085738dd4
@ -1,5 +1,7 @@
|
|||||||
package com.aizuda.snailjob.server.starter.schedule;
|
package com.aizuda.snailjob.server.starter.schedule;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollStreamUtil;
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import com.aizuda.snailjob.common.core.util.StreamUtils;
|
import com.aizuda.snailjob.common.core.util.StreamUtils;
|
||||||
import com.aizuda.snailjob.common.log.SnailJobLog;
|
import com.aizuda.snailjob.common.log.SnailJobLog;
|
||||||
import com.aizuda.snailjob.server.common.Lifecycle;
|
import com.aizuda.snailjob.server.common.Lifecycle;
|
||||||
@ -46,9 +48,9 @@ public class OfflineNodeSchedule extends AbstractSchedule implements Lifecycle {
|
|||||||
List<ServerNode> serverNodes = serverNodeMapper.selectList(
|
List<ServerNode> serverNodes = serverNodeMapper.selectList(
|
||||||
new LambdaQueryWrapper<ServerNode>().select(ServerNode::getId)
|
new LambdaQueryWrapper<ServerNode>().select(ServerNode::getId)
|
||||||
.le(ServerNode::getExpireAt, endTime));
|
.le(ServerNode::getExpireAt, endTime));
|
||||||
if (!CollectionUtils.isEmpty(serverNodes)) {
|
if (CollUtil.isNotEmpty(serverNodes)) {
|
||||||
// 先删除DB中需要下线的机器
|
// 先删除DB中需要下线的机器
|
||||||
serverNodeMapper.deleteBatchIds(serverNodes.stream().map(ServerNode::getId).collect(Collectors.toSet()));
|
serverNodeMapper.deleteBatchIds(StreamUtils.toSet(serverNodes, ServerNode::getId));
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<RegisterNodeInfo> allPods = CacheRegisterTable.getAllPods();
|
Set<RegisterNodeInfo> allPods = CacheRegisterTable.getAllPods();
|
||||||
|
Loading…
Reference in New Issue
Block a user