Ignore SSE send failures
All checks were successful
build-and-deploy / build-deploy (push) Successful in 33s
All checks were successful
build-and-deploy / build-deploy (push) Successful in 33s
This commit is contained in:
@@ -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<K>(
|
||||
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<K>(
|
||||
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<K>(
|
||||
for (emitter in list) {
|
||||
try {
|
||||
emitter.send(SseEmitter.event().name("ping").data("ok"))
|
||||
} catch (_: IOException) {
|
||||
} catch (_: Exception) {
|
||||
dead.add(emitter)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user