From e81a8d915e5bea858bbe2806d621d250ec85f505 Mon Sep 17 00:00:00 2001 From: Pearl Dsilva Date: Wed, 1 Oct 2025 09:31:27 -0400 Subject: [PATCH] Veeam: Use restore timeout as a time interval as opposed to a counter --- .../java/org/apache/cloudstack/backup/veeam/VeeamClient.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/plugins/backup/veeam/src/main/java/org/apache/cloudstack/backup/veeam/VeeamClient.java b/plugins/backup/veeam/src/main/java/org/apache/cloudstack/backup/veeam/VeeamClient.java index e2df854f16d..dfaca90d305 100644 --- a/plugins/backup/veeam/src/main/java/org/apache/cloudstack/backup/veeam/VeeamClient.java +++ b/plugins/backup/veeam/src/main/java/org/apache/cloudstack/backup/veeam/VeeamClient.java @@ -366,7 +366,9 @@ public class VeeamClient { * 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")) {