Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feature:support offline atomic command by lua #149

Conversation

cmgyqjj
Copy link
Contributor

@cmgyqjj cmgyqjj commented Sep 18, 2024

In the previous code, I noticed that there are some todos that need improvement. May I make some enhancements to the todo regarding the 'AccountServiceRedisImpl.offLine'?

@Override
public void offLine(Long userId) {

    // TODO: 2019-01-21 改为一个原子命令,以防数据一致性

    //删除路由
    redisTemplate.delete(ROUTE_PREFIX + userId);

    //删除登录状态
    userInfoCacheService.removeLoginStatus(userId);
}

As for the two instances of Redis deletion, I suggest using Lua scripts to execute them, to prevent the scenario where the route is deleted but the data remains inconsistent due to still being logged in.

@crossoverJie crossoverJie added this to the 
v2.0.0 milestone Sep 19, 2024
@crossoverJie crossoverJie added the enhancement New feature or request label Sep 19, 2024
@crossoverJie
Copy link
Owner

Could you please delete the unnecessary methods here?

@crossoverJie crossoverJie merged commit 2a0fdc1 into crossoverJie:master Sep 19, 2024
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants