PakhomovAlexander commented on code in PR #2334:
URL: https://github.com/apache/ignite-3/pull/2334#discussion_r1272384930


##########
modules/rest/src/main/java/org/apache/ignite/internal/rest/deployment/DeploymentManagementController.java:
##########
@@ -61,11 +60,17 @@ public CompletableFuture<Boolean> deploy(
             Optional<InitialDeployMode> deployMode,
             Optional<List<String>> initialNodes
     ) {
-        CompletableFuture<DeploymentUnit> result = new CompletableFuture<>();
-        unitContent.subscribe(new CompletedFileUploadSubscriber(result));
+
+        CompletedFileUploadSubscriber subscriber = new 
CompletedFileUploadSubscriber();
+        unitContent.subscribe(subscriber);
+
         NodesToDeploy nodesToDeploy = initialNodes.map(NodesToDeploy::new)
                 .orElseGet(() -> new 
NodesToDeploy(fromInitialDeployMode(deployMode)));
-        return deployment.deployAsync(unitId, 
Version.parseVersion(unitVersion), result, nodesToDeploy);
+        return subscriber.result().thenCompose(content -> {
+            return deployment.deployAsync(unitId, 
Version.parseVersion(unitVersion), content, nodesToDeploy)
+                    .whenComplete((res, err) -> content.close());

Review Comment:
   This is not obvious at all that I should close a resource I've not allocated 
in Controller. I would like to make it obvious.



-- 
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.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to