aboutsummaryrefslogtreecommitdiffstats
path: root/adapters/mso-adapter-utils/src/main/java/org/onap
diff options
context:
space:
mode:
authorMnushkin, Dmitry <dmitry.mnushkin@att.com>2020-09-23 16:26:31 -0400
committerBenjamin, Max (mb388a) <mb388a@att.com>2020-10-01 11:56:16 -0400
commit7c996cbd1735e4c570bef411c8fbbec0db44faea (patch)
treecafdde68d7f16eab23ce04626dfdf5b4e764ce4f /adapters/mso-adapter-utils/src/main/java/org/onap
parentabe12dca0faad2a6d79750d559d2a80fe8532996 (diff)
use timeout interval in minutes for poll duration
use timeout interval in minutes for poll duration do not ignore retry test with 1 min delay rename variable and debug info for clarity Issue-ID: SO-3264 Signed-off-by: Benjamin, Max (mb388a) <mb388a@att.com> Change-Id: Ia3c6d789b0e93df909476e92764ccbb32d7472e7
Diffstat (limited to 'adapters/mso-adapter-utils/src/main/java/org/onap')
-rw-r--r--adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java16
1 files changed, 9 insertions, 7 deletions
diff --git a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
index c33160d255..a7c47f8f53 100644
--- a/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
+++ b/adapters/mso-adapter-utils/src/main/java/org/onap/so/openstack/utils/MsoHeatUtils.java
@@ -24,6 +24,7 @@
package org.onap.so.openstack.utils;
import java.io.IOException;
+import java.time.LocalDateTime;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
@@ -124,10 +125,8 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
// Properties names and variables (with default values)
protected String createPollIntervalProp = "org.onap.so.adapters.po.pollInterval";
- private String pollingMultiplierProp = "org.onap.so.adapters.po.pollMultiplier";
protected static final String CREATE_POLL_INTERVAL_DEFAULT = "15";
- private static final String POLLING_MULTIPLIER_DEFAULT = "60";
private static final ObjectMapper JSON_MAPPER = new ObjectMapper();
@@ -348,9 +347,12 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
String tenantId, boolean notFoundIsSuccess) throws MsoException {
int pollingFrequency =
Integer.parseInt(this.environment.getProperty(createPollIntervalProp, CREATE_POLL_INTERVAL_DEFAULT));
- int pollingMultiplier =
- Integer.parseInt(this.environment.getProperty(pollingMultiplierProp, POLLING_MULTIPLIER_DEFAULT));
- int numberOfPollingAttempts = Math.floorDiv((timeoutMinutes * pollingMultiplier), pollingFrequency);
+ LocalDateTime stopPolling = LocalDateTime.now().plusMinutes(timeoutMinutes);
+ if (pollingFrequency > timeoutMinutes * 60) {
+ logger.debug("Will not poll. Poll interval {} sec is greater then timeout {} sec", pollingFrequency,
+ timeoutMinutes * 60);
+ stopPolling = LocalDateTime.now().minusMinutes(1);
+ }
Heat heatClient = getHeatClient(cloudSiteId, tenantId);
while (true) {
String stackName = stack.getStackName() + "/" + stack.getId();
@@ -363,12 +365,12 @@ public class MsoHeatUtils extends MsoCommonUtils implements VduPlugin {
} else if (latestStack != null) {
statusHandler.updateStackStatus(latestStack);
if (stackStatus.equals(latestStack.getStackStatus())) {
- if (numberOfPollingAttempts <= 0) {
+ if (LocalDateTime.now().isAfter(stopPolling)) {
logger.error("Polling of stack timed out with Status: {}", latestStack.getStackStatus());
return latestStack;
}
+ logger.debug("Will poll again until {}", stopPolling);
sleep(pollingFrequency * 1000L);
- numberOfPollingAttempts -= 1;
} else {
return latestStack;
}