移除超时的在线用户-完成
parent
2cb7302d30
commit
5803258ed7
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -105,9 +105,11 @@ public class SysUserSessionServiceImpl implements SysUserSessionService {
|
|||
|
||||
@Override
|
||||
public long clearSessionTimeout() {
|
||||
// 获取db里已经超时的用户列表
|
||||
Long timeoutCount = 0L;
|
||||
List<SysUserSessionDO> sessionDOS = userSessionMapper.selectSessionTimeout();
|
||||
for (SysUserSessionDO sessionDO : sessionDOS) {
|
||||
List<SysUserSessionDO> sessionTimeoutDOS = userSessionMapper.selectSessionTimeout();
|
||||
for (SysUserSessionDO sessionDO : sessionTimeoutDOS) {
|
||||
// 确认已经超时,移出在线用户列表
|
||||
if (loginUserRedisDAO.get(sessionDO.getId()) == null) {
|
||||
timeoutCount += userSessionMapper.deleteById(sessionDO.getId());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue