移除超时的在线用户-完成
This commit is contained in:
parent
2cb7302d30
commit
5803258ed7
@ -21,9 +21,9 @@ public class SysUserSessionTimeoutJob implements JobHandler {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String execute(String param) throws Exception {
|
public String execute(String param) throws Exception {
|
||||||
log.info("[execute][执行任务:{}]", "清除过期用户信息");
|
log.info("[execute][执行任务:{}]", "移除超时的在线用户");
|
||||||
long timeoutCount = sysUserSessionService.clearSessionTimeout();
|
long timeoutCount = sysUserSessionService.clearSessionTimeout();
|
||||||
log.info("[execute][执行任务:{}]", "清楚过期用户信息完成" + timeoutCount);
|
log.info("[execute][执行任务:{}]", "移除超时的在线用户完成" + timeoutCount);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -105,9 +105,11 @@ public class SysUserSessionServiceImpl implements SysUserSessionService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public long clearSessionTimeout() {
|
public long clearSessionTimeout() {
|
||||||
|
// 获取db里已经超时的用户列表
|
||||||
Long timeoutCount = 0L;
|
Long timeoutCount = 0L;
|
||||||
List<SysUserSessionDO> sessionDOS = userSessionMapper.selectSessionTimeout();
|
List<SysUserSessionDO> sessionTimeoutDOS = userSessionMapper.selectSessionTimeout();
|
||||||
for (SysUserSessionDO sessionDO : sessionDOS) {
|
for (SysUserSessionDO sessionDO : sessionTimeoutDOS) {
|
||||||
|
// 确认已经超时,移出在线用户列表
|
||||||
if (loginUserRedisDAO.get(sessionDO.getId()) == null) {
|
if (loginUserRedisDAO.get(sessionDO.getId()) == null) {
|
||||||
timeoutCount += userSessionMapper.deleteById(sessionDO.getId());
|
timeoutCount += userSessionMapper.deleteById(sessionDO.getId());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user