You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@datalab.apache.org by GitBox <gi...@apache.org> on 2020/12/03 14:44:19 UTC
[GitHub] [incubator-datalab] ofuks commented on a change in pull request #996: [DATALAB-2152]: fixed sync with clusters.
ofuks commented on a change in pull request #996:
URL: https://github.com/apache/incubator-datalab/pull/996#discussion_r535287775
##########
File path: services/provisioning-service/src/main/java/com/epam/datalab/backendapi/core/response/handlers/ResourcesStatusCallbackHandler.java
##########
@@ -115,9 +114,17 @@ public void handleError(String errorMessage) {
.collect(Collectors.toList());
}
- private Map<String, EnvResource> getEnvResources(List<EnvResource> envResources) {
- return envResources
- .stream()
+ private Map<String, EnvResource> getEnvResources(EnvResourceList envResources) {
+ List<EnvResource> envCopy = Stream.concat(envResources.getClusterList().stream(), envResources.getHostList().stream())
+ .collect(Collectors.toList());
+
+ return envCopy.stream()
.collect(Collectors.toMap(EnvResource::getId, e -> e));
Review comment:
Can we inline it?
##########
File path: services/provisioning-service/src/main/java/com/epam/datalab/backendapi/core/response/handlers/ResourcesStatusCallbackHandler.java
##########
@@ -115,9 +114,17 @@ public void handleError(String errorMessage) {
.collect(Collectors.toList());
}
- private Map<String, EnvResource> getEnvResources(List<EnvResource> envResources) {
- return envResources
- .stream()
+ private Map<String, EnvResource> getEnvResources(EnvResourceList envResources) {
+ List<EnvResource> envCopy = Stream.concat(envResources.getClusterList().stream(), envResources.getHostList().stream())
+ .collect(Collectors.toList());
+
+ return envCopy.stream()
.collect(Collectors.toMap(EnvResource::getId, e -> e));
}
+
+ private List<EnvResource> getListOrEmpty(List<EnvResource> source) {
+ return source != null ?
+ getChangedEnvResources(source) :
+ Collections.emptyList();
+ }
Review comment:
Can we use the Optional class with its methods instead?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@datalab.apache.org
For additional commands, e-mail: dev-help@datalab.apache.org