Add warning logs for missing emitters and failed event delivery in EventPublisher
This commit is contained in:
+2
@@ -95,6 +95,7 @@ public class EventPublisher {
|
|||||||
public void sendToUser(String uniqueKey, String eventName, String json) {
|
public void sendToUser(String uniqueKey, String eventName, String json) {
|
||||||
List<SseEmitter> userEmitters = emitterMap.get(uniqueKey);
|
List<SseEmitter> userEmitters = emitterMap.get(uniqueKey);
|
||||||
if (userEmitters == null) {
|
if (userEmitters == null) {
|
||||||
|
log.warn("No emitters found for unique key: {}", uniqueKey);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,6 +103,7 @@ public class EventPublisher {
|
|||||||
try {
|
try {
|
||||||
emitter.send(SseEmitter.event().name(eventName).data(json));
|
emitter.send(SseEmitter.event().name(eventName).data(json));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
|
log.warn("Failed to send event to user: {}", uniqueKey, e);
|
||||||
cleanup(emitter);
|
cleanup(emitter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user