Skip to content
Merged

fix #1151

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -912,6 +912,13 @@
modificationUuidsByNodes.computeIfAbsent(nodeId, k -> new ArrayList<>()).add(ref.getReferenceId());
}
}));
modificationUuidsByNodes.entrySet().forEach(entry -> studyService.sharedModificationsUpdatedNotification(entry.getKey(), entry.getValue(), onlyMetadata));
// a failure on one node must not prevent notifying the other nodes
modificationUuidsByNodes.forEach((nodeUuid, modificationUuids) -> {
try {
studyService.sharedModificationsUpdatedNotification(nodeUuid, modificationUuids, onlyMetadata);
} catch (Exception e) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LOGGER.error(String.format("Could not handle shared modifications update for node %s", nodeUuid), e); ?

LOGGER.error(String.format("Could not handle shared modifications update for node %s", nodeUuid), e);

Check warning on line 920 in src/main/java/org/gridsuite/study/server/service/ConsumerService.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Use the logger's built-in "{}" formatting instead of "String.format".

See more on https://sonarcloud.io/project/issues?id=org.gridsuite%3Astudy-server&issues=AaF9dbthegCxvtBRiFJX&open=AaF9dbthegCxvtBRiFJX&pullRequest=1151
}
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,25 @@ void testStudyNodeAndCompositeReferencesInDifferentNode() {
verify(studyService, times(1)).sharedModificationsUpdatedNotification(node2Uuid, List.of(compositeModificationUuid), false);
}

@Test
void testFailureOnOneNodeDoesNotPreventOtherNodesNotification() {
UUID failingNodeUuid = UUID.randomUUID();
UUID nodeUuid = UUID.randomUUID();
UUID failingModificationUuid = UUID.randomUUID();
UUID modificationUuid = UUID.randomUUID();

doThrow(new RuntimeException("node notification failure"))
.when(studyService).sharedModificationsUpdatedNotification(eq(failingNodeUuid), anyList(), anyBoolean());

consumeSharedElementUpdate.accept(sharedElementUpdateMessage(
List.of(createStudyNodeReference(failingModificationUuid, failingNodeUuid)),
List.of(createCompositeReference(modificationUuid, nodeUuid))));

verify(studyService, times(2)).sharedModificationsUpdatedNotification(any(), anyList(), anyBoolean());
verify(studyService, times(1)).sharedModificationsUpdatedNotification(failingNodeUuid, List.of(failingModificationUuid), false);
verify(studyService, times(1)).sharedModificationsUpdatedNotification(nodeUuid, List.of(modificationUuid), false);
}

@Test
void testNoSharedCompositeUpdated() {
consumeSharedElementUpdate.accept(sharedElementUpdateMessage(List.of(), List.of()));
Expand Down
Loading