Commit 3043e31a authored by Szabolcs Gyurko's avatar Szabolcs Gyurko
Browse files

Added error handling around batch requests

parent b6914c98
Pipeline #323 failed with stage
in 3 minutes and 49 seconds
......@@ -88,10 +88,13 @@ public class UIService {
List<Node> children = getNodeTreeBatch(Collections.singletonList(path));
while (!children.isEmpty()) {
allNodes.addAll(children);
children = getNodeTreeBatch(children.stream()
children = getNodeTreeBatch(
children.stream()
.flatMap(n -> n.getChildren().stream()
.map(c -> n.getPath().endsWith("/") ? n.getPath() + c : n.getPath() + "/" + c))
.collect(Collectors.toList()));
.map(c -> n.getPath().endsWith("/") ? n.getPath() + c : n.getPath() + "/" + c)
)
.collect(Collectors.toList())
);
}
return (NodeTree) conversionService.convert(
......@@ -109,13 +112,19 @@ public class UIService {
batchReadRequest.setPreFetchBinary(false);
batchReadRequest.setNodes(paths);
final ResponseEntity<List<Node>> result = restTemplate.exchange(
urlUtils.getBatchUrl(),
HttpMethod.POST,
urlUtils.authenticatedEntity(batchReadRequest),
new ParameterizedTypeReference<List<Node>>() {
});
return result.getBody();
try {
final ResponseEntity<List<Node>> result = restTemplate.exchange(
urlUtils.getBatchUrl(),
HttpMethod.POST,
urlUtils.authenticatedEntity(batchReadRequest),
new ParameterizedTypeReference<List<Node>>() {
});
return result.getBody();
} catch (Exception e) {
LOGGER.warn("Could not get batch results from jeff-node: {}", e.getMessage());
LOGGER.warn("Paths requested were: {}", paths.stream().collect(StringBuilder::new, (c, el) -> c.append("-> ").append(el).append('\n'), (r, c) -> r.append(c.toString())).toString());
return Collections.emptyList();
}
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment