Removed redundant messages.

This commit is contained in:
Andrew Lalis 2021-11-26 18:52:26 +01:00
parent fe92f2903c
commit 91988c17b0
1 changed files with 4 additions and 2 deletions

View File

@ -201,10 +201,12 @@ public class SignalService {
private void broadcastToConnectedSignals(Branch branch) {
try {
WebSocketMessage<String> msg = new TextMessage(mapper.writeValueAsString(new BranchUpdateMessage(branch.getId(), branch.getStatus().name())));
WebSocketMessage<String> msg = new TextMessage(mapper.writeValueAsString(
new BranchUpdateMessage(branch.getId(), branch.getStatus().name())
));
signalRepository.findAllConnectedToBranch(branch).stream()
.map(s -> getSignalWebSocketSession(s.getId()))
.filter(Objects::nonNull)
.filter(Objects::nonNull).distinct()
.forEach(session -> {
try {
session.sendMessage(msg);