吴远 3 months ago
parent
commit
b69d0498aa
  1. 4
      dk-modules/sample/src/main/java/org/dromara/sample/component/GlobalScheduleService.java

4
dk-modules/sample/src/main/java/org/dromara/sample/component/GlobalScheduleService.java

@ -42,7 +42,6 @@ public class GlobalScheduleService {
@Scheduled(initialDelay = 10, fixedRate = 30, timeUnit = TimeUnit.SECONDS) @Scheduled(initialDelay = 10, fixedRate = 30, timeUnit = TimeUnit.SECONDS)
private void deviceStatusListen() { private void deviceStatusListen() {
int start = RedisConst.DEVICE_ONLINE_PREFIX.length(); int start = RedisConst.DEVICE_ONLINE_PREFIX.length();
redisOpsUtils.getAllKeys(RedisConst.DEVICE_ONLINE_PREFIX + "*").forEach(key -> { redisOpsUtils.getAllKeys(RedisConst.DEVICE_ONLINE_PREFIX + "*").forEach(key -> {
long expire = redisOpsUtils.getExpire(key); long expire = redisOpsUtils.getExpire(key);
if (expire <= 30) { if (expire <= 30) {
@ -50,6 +49,9 @@ public class GlobalScheduleService {
if (null == device) { if (null == device) {
return; return;
} }
if(device.getWorkspaceId().isEmpty()){
return;
}
if (DeviceDomainEnum.DRONE == device.getDomain()) { if (DeviceDomainEnum.DRONE == device.getDomain()) {
deviceService.subDeviceOffline(key.substring(start)); deviceService.subDeviceOffline(key.substring(start));
} else { } else {

Loading…
Cancel
Save