no need to log if we're not sending any notification

This commit is contained in:
Athou
2023-04-30 21:47:29 +02:00
parent 9a2dda626c
commit 4a40f2b8f7

View File

@@ -34,10 +34,12 @@ public class WebSocketSessions {
.flatMap(e -> e.getValue().stream())
.collect(Collectors.toSet());
log.debug("sending '{}' to {} users via websocket", text, userSessions.size());
for (Session userSession : userSessions) {
if (userSession.isOpen()) {
userSession.getAsyncRemote().sendText(text);
if (!userSessions.isEmpty()) {
log.debug("sending '{}' to {} users via websocket", text, userSessions.size());
for (Session userSession : userSessions) {
if (userSession.isOpen()) {
userSession.getAsyncRemote().sendText(text);
}
}
}
}