From 0771631b5acd5b71699987d3c83bd0476649496b Mon Sep 17 00:00:00 2001 From: androidlover5842 Date: Sat, 31 Jan 2026 11:10:21 +0530 Subject: [PATCH] Ignore SSE send failures --- .../com/android/trisolarisserver/component/SseHub.kt | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main/kotlin/com/android/trisolarisserver/component/SseHub.kt b/src/main/kotlin/com/android/trisolarisserver/component/SseHub.kt index 2422b1d..1b88afd 100644 --- a/src/main/kotlin/com/android/trisolarisserver/component/SseHub.kt +++ b/src/main/kotlin/com/android/trisolarisserver/component/SseHub.kt @@ -1,7 +1,6 @@ package com.android.trisolarisserver.component import org.springframework.web.servlet.mvc.method.annotation.SseEmitter -import java.io.IOException import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.CopyOnWriteArrayList @@ -19,7 +18,7 @@ class SseHub( emitter.onError { emitters[key]?.remove(emitter) } try { emitter.send(SseEmitter.event().name(eventName).data(snapshot(key))) - } catch (_: IOException) { + } catch (_: Exception) { emitters[key]?.remove(emitter) } return emitter @@ -32,7 +31,7 @@ class SseHub( for (emitter in list) { try { emitter.send(SseEmitter.event().name(eventName).data(data)) - } catch (_: IOException) { + } catch (_: Exception) { dead.add(emitter) } } @@ -47,7 +46,7 @@ class SseHub( for (emitter in list) { try { emitter.send(SseEmitter.event().name("ping").data("ok")) - } catch (_: IOException) { + } catch (_: Exception) { dead.add(emitter) } }