From fcf8516f0d9c50237ab3ebb47a6ae17f639ce3ad Mon Sep 17 00:00:00 2001
From: 疯狂的狮子Li <15040126243@163.com>
Date: 星期三, 31 七月 2024 09:48:05 +0800
Subject: [PATCH] update 优化 适配 anyline 新改动

---
 ruoyi-common/ruoyi-common-sse/src/main/java/org/dromara/common/sse/core/SseEmitterManager.java |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/ruoyi-common/ruoyi-common-sse/src/main/java/org/dromara/common/sse/core/SseEmitterManager.java b/ruoyi-common/ruoyi-common-sse/src/main/java/org/dromara/common/sse/core/SseEmitterManager.java
index 0f096fa..91dd71d 100644
--- a/ruoyi-common/ruoyi-common-sse/src/main/java/org/dromara/common/sse/core/SseEmitterManager.java
+++ b/ruoyi-common/ruoyi-common-sse/src/main/java/org/dromara/common/sse/core/SseEmitterManager.java
@@ -1,5 +1,6 @@
 package org.dromara.common.sse.core;
 
+import cn.dev33.satoken.stp.StpUtil;
 import cn.hutool.core.collection.CollUtil;
 import lombok.extern.slf4j.Slf4j;
 import org.dromara.common.redis.utils.RedisUtils;
@@ -71,6 +72,11 @@
         if (emitters != null) {
             for (Map.Entry<String, SseEmitter> entry : emitters.entrySet()) {
                 try {
+                    // token 鏃犳晥鎴栧凡杩囨湡
+                    if (StpUtil.stpLogic.getTokenActiveTimeoutByToken(entry.getKey()) < -1) {
+                        emitters.remove(entry.getKey());
+                        continue;
+                    }
                     entry.getValue().send(SseEmitter.event()
                         .name("message")
                         .data(message));

--
Gitblit v1.9.3