X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=cps-ncmp-service%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fcps%2Fncmp%2Fapi%2Finventory%2Fsync%2FSyncUtils.java;h=046a116efa99a1e42f48535f31ac453c078ffd19;hb=d797b35547c24f3ebd6bd5ad53eed1891d5783b3;hp=e742b8c0f7af73a9e0a8c772aed2619130844137;hpb=4e596846aa6f1b799487c553d6830004489d96a1;p=cps.git diff --git a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/sync/SyncUtils.java b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/sync/SyncUtils.java index e742b8c0f..046a116ef 100644 --- a/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/sync/SyncUtils.java +++ b/cps-ncmp-service/src/main/java/org/onap/cps/ncmp/api/inventory/sync/SyncUtils.java @@ -151,18 +151,22 @@ public class SyncUtils { * @return if the retry mechanism should be attempted */ public boolean isReadyForRetry(final CompositeState compositeState) { - int timeUntilNextAttempt = 1; + int timeInMinutesUntilNextAttempt = 1; final OffsetDateTime time = OffsetDateTime.parse(compositeState.getLastUpdateTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss.SSSZ")); final Matcher matcher = retryAttemptPattern.matcher(compositeState.getLockReason().getDetails()); if (matcher.find()) { - timeUntilNextAttempt = (int) Math.pow(2, Integer.parseInt(matcher.group(1))); + timeInMinutesUntilNextAttempt = (int) Math.pow(2, Integer.parseInt(matcher.group(1))); } else { log.debug("First Attempt: no current attempts found."); } final int timeSinceLastAttempt = (int) Duration.between(time, OffsetDateTime.now()).toMinutes(); - return timeSinceLastAttempt > timeUntilNextAttempt; + if (timeInMinutesUntilNextAttempt >= timeSinceLastAttempt) { + log.info("Time until next attempt is {} minutes: ", + timeInMinutesUntilNextAttempt - timeSinceLastAttempt); + } + return timeSinceLastAttempt > timeInMinutesUntilNextAttempt; } /**