diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/job/auth/SysUserSessionTimeoutJob.java b/src/main/java/cn/iocoder/dashboard/modules/system/job/auth/SysUserSessionTimeoutJob.java index ff5fa2f2d..799fe115f 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/job/auth/SysUserSessionTimeoutJob.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/job/auth/SysUserSessionTimeoutJob.java @@ -21,9 +21,9 @@ public class SysUserSessionTimeoutJob implements JobHandler { @Override public String execute(String param) throws Exception { - log.info("[execute][执行任务:{}]", "清除过期用户信息"); + log.info("[execute][执行任务:{}]", "移除超时的在线用户"); long timeoutCount = sysUserSessionService.clearSessionTimeout(); - log.info("[execute][执行任务:{}]", "清楚过期用户信息完成" + timeoutCount); + log.info("[execute][执行任务:{}]", "移除超时的在线用户完成" + timeoutCount); return null; } diff --git a/src/main/java/cn/iocoder/dashboard/modules/system/service/auth/impl/SysUserSessionServiceImpl.java b/src/main/java/cn/iocoder/dashboard/modules/system/service/auth/impl/SysUserSessionServiceImpl.java index 0c192a404..e1fb1fa2f 100644 --- a/src/main/java/cn/iocoder/dashboard/modules/system/service/auth/impl/SysUserSessionServiceImpl.java +++ b/src/main/java/cn/iocoder/dashboard/modules/system/service/auth/impl/SysUserSessionServiceImpl.java @@ -105,9 +105,11 @@ public class SysUserSessionServiceImpl implements SysUserSessionService { @Override public long clearSessionTimeout() { + // 获取db里已经超时的用户列表 Long timeoutCount = 0L; - List sessionDOS = userSessionMapper.selectSessionTimeout(); - for (SysUserSessionDO sessionDO : sessionDOS) { + List sessionTimeoutDOS = userSessionMapper.selectSessionTimeout(); + for (SysUserSessionDO sessionDO : sessionTimeoutDOS) { + // 确认已经超时,移出在线用户列表 if (loginUserRedisDAO.get(sessionDO.getId()) == null) { timeoutCount += userSessionMapper.deleteById(sessionDO.getId()); }