ppapou commented on a change in pull request #926:
URL: https://github.com/apache/incubator-datalab/pull/926#discussion_r505737990



##########
File path: 
services/self-service/src/main/java/com/epam/dlab/backendapi/service/impl/OdahuServiceImpl.java
##########
@@ -91,7 +91,9 @@ public OdahuServiceImpl(ProjectService projectService, 
EndpointService endpointS
     @BudgetLimited
     @Override
     public void create(@Project String project, OdahuCreateDTO odahuCreateDTO, 
UserInfo user) {
-        Optional<OdahuDTO> odahuDTO = 
odahuDAO.getByProjectEndpoint(odahuCreateDTO.getProject(), 
odahuCreateDTO.getEndpoint());
+        Optional<OdahuDTO> odahuDTO = odahuDAO
+                .getByProjectEndpoint(odahuCreateDTO.getProject(), 
odahuCreateDTO.getEndpoint())
+                .filter(p -> p.getStatus().equals(UserInstanceStatus.FAILED));

Review comment:
       the Optional filter behavior. If a value is present, and the value 
matches the given predicate, return an Optional describing the value, otherwise 
return an empty Optional.
   




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to