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) {
|
||||
List<SseEmitter> userEmitters = emitterMap.get(uniqueKey);
|
||||
if (userEmitters == null) {
|
||||
log.warn("No emitters found for unique key: {}", uniqueKey);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -102,6 +103,7 @@ public class EventPublisher {
|
||||
try {
|
||||
emitter.send(SseEmitter.event().name(eventName).data(json));
|
||||
} catch (IOException e) {
|
||||
log.warn("Failed to send event to user: {}", uniqueKey, e);
|
||||
cleanup(emitter);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user