Skip to content

Commit

Permalink
[Optimized ]Optimized sse connect (DataLinkDC#3193)
Browse files Browse the repository at this point in the history
Co-authored-by: gaoyan1998 <[email protected]>
  • Loading branch information
gaoyan1998 and gaoyan1998 authored Feb 28, 2024
1 parent 51b9c0c commit daf59c7
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,10 +67,8 @@ public static Set<String> subscribeTopic(String sessionId, List<String> topics)
*/
public static SseEmitter connectSession(String sessionKey) {
log.debug("New session wants to connect: {}", sessionKey);
if (exists(sessionKey)) {
log.warn("Session key already exists: {}", sessionKey);
closeSse(sessionKey);
}
log.warn("Session key already exists: {},replace it", sessionKey);

SseEmitter sseEmitter = new SseEmitter(60 * 1000L * 10);
sseEmitter.onError(err -> onError(sessionKey, err));
sseEmitter.onTimeout(() -> onTimeout(sessionKey));
Expand Down

0 comments on commit daf59c7

Please sign in to comment.