Skip to content
Snippets Groups Projects
Commit b3c09a07 authored by Nicola Fulvio Calabria's avatar Nicola Fulvio Calabria
Browse files

unlock nodes in case of copyNode failure after file service call

parent 7184b385
No related branches found
No related tags found
No related merge requests found
......@@ -18,6 +18,7 @@ import it.inaf.oats.vospace.exception.InvalidArgumentException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import it.inaf.oats.vospace.exception.VoSpaceErrorSummarizableException;
import it.inaf.oats.vospace.persistence.NodeDAO;
import java.util.List;
import java.util.Optional;
import java.util.concurrent.CompletableFuture;
......@@ -52,6 +53,9 @@ public class JobService {
@Autowired
private FileServiceClient fileServiceClient;
@Autowired
private NodeDAO nodeDao;
public enum JobDirection {
pullToVoSpace,
......@@ -193,10 +197,19 @@ public class JobService {
User user = (User) servletRequest.getUserPrincipal();
CompletableFuture.runAsync(() -> {
handleJobErrors(jobSummary, job -> {
String jobId = jobSummary.getJobId();
// Index 0: source 1: destination
List<String> sourceAndDestination = copyService.processCopyNodes(transfer, jobId, user);
// Call file service and command copy
try{
fileServiceClient.startFileCopyJob(sourceAndDestination.get(0), sourceAndDestination.get(1), jobId, user);
} catch (Exception e) {
// We decided not to purge metadata in case of failure
// just release busy nodes setting job_id = null
nodeDao.releaseBusyNodesByJobId(jobId);
throw e;
}
return null;
});
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment