Commit 788fe756 authored by Leigh B Stoller's avatar Leigh B Stoller

Run DeleteSlice in the background so it returns to the caller

much quicker.
parent 3522a680
......@@ -417,6 +417,11 @@ sub DeleteSliver()
'credentials' => $credentials
};
my $response = GeniCMV2::DeleteSlice($delete_args);
if (!ref($response)) {
# This is cause GeniCMV2::DeleteSlice does a fork, and the child
# returns plain status code, which should go to our caller.
return $response;
}
if (GeniResponse::IsError($response)) {
return $response;
} else {
......@@ -1210,6 +1215,11 @@ sub Delete
'credentials' => $credentials
};
my $response = GeniCMV2::DeleteSlice($args);
if (!ref($response)) {
# This is cause GeniCMV2::DeleteSlice does a fork, and the child
# returns plain status code, which should go to our caller.
return $response;
}
if (! GeniResponse::IsError($response)) {
$response = GeniResponse->Create(GENIRESPONSE_SUCCESS, $slivers);
}
......
......@@ -740,13 +740,22 @@ sub DeleteSlice($)
$slice->UnLock();
return GeniResponse->BusyResponse();
}
#
# Proceed in the background. No reason to make the caller wait,
# it takes too long.
#
my $mypid = main::WrapperFork();
if ($mypid) {
return GeniResponse->Create(GENIRESPONSE_SUCCESS);
}
if (GeniCM::CleanupDeadSlice($slice, 1) != 0) {
return GeniResponse->Create(GENIRESPONSE_ERROR, undef,
"Could not cleanup slice");
#
# We may need to send email here.
#
return -1;
}
done:
return GeniResponse->Create(GENIRESPONSE_SUCCESS);
return 0;
}
#
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment