liusuyi
2025-10-24 f322a0c1ae9ecb5c7af208ace8880fdf179c1f2a
修改websocket订阅线程池数量10
修改令牌有效期10分钟
3 files modified
7 ■■■■■ changed files
ard-admin/src/main/resources/application.yml 2 ●●●●● patch | view | raw | blame | history
ard-framework/src/main/java/com/ard/framework/security/handle/CustomAuthenticationSuccessHandler.java 3 ●●●●● patch | view | raw | blame | history
ard-work/src/main/java/com/ard/work/component/websocket/handler/BaseSubscriptionManager.java 2 ●●●●● patch | view | raw | blame | history
ard-admin/src/main/resources/application.yml
@@ -44,7 +44,7 @@
  # 令牌密钥
  secret: abcdefghijklmnopqrstuvwxyz
  # 令牌有效期(默认30分钟)
  expireTime: 720
  expireTime: 10
  # 是否允许账户多终端同时登录(true允许 false不允许)
  soloLogin: true
ard-framework/src/main/java/com/ard/framework/security/handle/CustomAuthenticationSuccessHandler.java
@@ -1,5 +1,6 @@
package com.ard.framework.security.handle;
import com.ard.common.constant.Constants;
import com.ard.common.core.redis.RedisCache;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -12,7 +13,7 @@
    public void onAuthenticationSuccess(Long userId) {
        // 检查 Redis 中是否已有该用户登录
        String key = "login_userid:" + userId;
        String key = Constants.LOGIN_USERID_KEY + userId;
        if (redisCache.hasKey(key)) {
            throw new RuntimeException("用户已登录,请勿重复登录");
        }
ard-work/src/main/java/com/ard/work/component/websocket/handler/BaseSubscriptionManager.java
@@ -16,7 +16,7 @@
    // 存储订阅的用户
    protected final Map<String, Set<Long>> subscriptions = new ConcurrentHashMap<>();
    // 定时任务调度器
    protected final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(1);
    protected final ScheduledExecutorService scheduler = Executors.newScheduledThreadPool(10);
    // 存储推送任务
    protected final Map<String, ScheduledFuture<?>> pushTasks = new ConcurrentHashMap<>();