File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed
backend/src/main/java/io/f1/backend/domain/game/sse/app Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ public class SseService {
2121 private final ScheduledExecutorService scheduler = Executors .newScheduledThreadPool (1 );
2222
2323 public SseEmitter subscribe () {
24- SseEmitter emitter = new SseEmitter (5_000L );
24+ SseEmitter emitter = new SseEmitter (1_800_000L );
2525 emitterRepository .save (emitter );
2626
2727 try {
@@ -44,16 +44,12 @@ public <T> void notifyLobbyUpdate(LobbySseEvent<T> event) {
4444 }
4545
4646 private void startHeartBeat (SseEmitter emitter ) {
47- scheduler .scheduleAtFixedRate (
48- () -> {
49- try {
50- emitter .send (SseEmitter .event ().name ("heartbeat" ).data ("sse-alive" ));
51- } catch (IOException e ) {
52- emitterRepository .remove (emitter );
53- }
54- },
55- 5 ,
56- 60 ,
57- TimeUnit .SECONDS );
47+ scheduler .scheduleAtFixedRate (() -> {
48+ try {
49+ emitter .send (SseEmitter .event ().name ("heartbeat" ).data ("sse-alive" ));
50+ } catch (IOException e ) {
51+ emitterRepository .remove (emitter );
52+ }
53+ }, 5 , 30 , TimeUnit .SECONDS );
5854 }
5955}
You can’t perform that action at this time.
0 commit comments