Skip to content

Commit

Permalink
remove async threads in purge request
Browse files Browse the repository at this point in the history
  • Loading branch information
WangLiNaruto committed Jan 23, 2024
1 parent 03f05a3 commit 703323c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ public Response purge(@PathVariable("id") String id) {
"No permissions to purge services belonging to other users.");
}
DeployTask purgeTask = this.deployService.getPurgeTask(deployServiceEntity);
this.deployService.asyncPurgeService(purgeTask, deployServiceEntity);
this.deployService.purgeService(purgeTask, deployServiceEntity);
String successMsg = String.format("Purging task for service with ID %s has started.", id);
return Response.successResponse(Collections.singletonList(successMsg));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.eclipse.xpanse.modules.orchestrator.deployment.DeployTask;
import org.eclipse.xpanse.modules.orchestrator.deployment.Deployer;
import org.slf4j.MDC;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Component;

/**
Expand Down Expand Up @@ -245,24 +244,13 @@ private void destroy(DeployTask destroyTask,
}
}

/**
* Async method to purge deployed service.
*
* @param deployTask deployTask
* @param deployServiceEntity deployServiceEntity
*/
@Async("xpanseAsyncTaskExecutor")
public void asyncPurgeService(DeployTask deployTask, DeployServiceEntity deployServiceEntity) {
purgeService(deployTask, deployServiceEntity);
}

/**
* purge the service based on the serviceDeploymentState.
*
* @param deployTask deployTask
* @param deployServiceEntity deployServiceEntity
*/
private void purgeService(DeployTask deployTask, DeployServiceEntity deployServiceEntity) {
public void purgeService(DeployTask deployTask, DeployServiceEntity deployServiceEntity) {
MDC.put(TASK_ID, deployTask.getId().toString());
try {
if (Objects.nonNull(deployServiceEntity.getDeployResourceList())
Expand Down

0 comments on commit 703323c

Please sign in to comment.