Skip to content
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,9 @@ private boolean checkTaskStatus(final HttpResponse response) throws IOException
* that is used to wait for the restore to complete before throwing a {@link CloudRuntimeException}.
*/
protected void checkIfRestoreSessionFinished(String type, String path) throws IOException {
for (int j = 0; j < restoreTimeout; j++) {
long startTime = System.currentTimeMillis();
long timeoutMs = restoreTimeout * 1000L;
if (System.currentTimeMillis() - startTime < timeoutMs) {
HttpResponse relatedResponse = get(path);
RestoreSession session = parseRestoreSessionResponse(relatedResponse);
if (session.getResult().equals("Success")) {
Expand All @@ -380,7 +382,8 @@ protected void checkIfRestoreSessionFinished(String type, String path) throws IO
getRestoreVmErrorDescription(StringUtils.substringAfterLast(sessionUid, ":"))));
throw new CloudRuntimeException(String.format("Restore job [%s] failed.", sessionUid));
}
logger.debug(String.format("Waiting %s seconds, out of a total of %s seconds, for the restore backup process to finish.", j, restoreTimeout));
logger.debug(String.format("Waiting %d seconds, out of a total of %d seconds, for the restore backup process to finish.",
(System.currentTimeMillis() - startTime) / 1000, restoreTimeout));

try {
Thread.sleep(1000);
Expand Down
Loading