From d8838e3d85746c171757ccd63a42c46cf661f14c Mon Sep 17 00:00:00 2001 From: Jeremy Long <jeremy.long@gmail.com> Date: Sat, 25 Nov 2023 08:03:38 -0500 Subject: [PATCH] fix: correct debug messages (#96) --- .../client/nvd/NvdApiRetryStrategy.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/open-vulnerability-clients/src/main/java/io/github/jeremylong/openvulnerability/client/nvd/NvdApiRetryStrategy.java b/open-vulnerability-clients/src/main/java/io/github/jeremylong/openvulnerability/client/nvd/NvdApiRetryStrategy.java index 5322b3c2..e97751e3 100644 --- a/open-vulnerability-clients/src/main/java/io/github/jeremylong/openvulnerability/client/nvd/NvdApiRetryStrategy.java +++ b/open-vulnerability-clients/src/main/java/io/github/jeremylong/openvulnerability/client/nvd/NvdApiRetryStrategy.java @@ -62,9 +62,9 @@ public NvdApiRetryStrategy(int maxRetries, long delay) { @Override public boolean retryRequest(HttpRequest request, IOException exception, int execCount, HttpContext context) { - if (execCount>=(maxRetries/2)) { + if (execCount >= (maxRetries / 2)) { LOG.warn("NVD API request failures are occurring; retrying request for the {} time", execCount); - } else { + } else if (execCount > 1) { LOG.debug("Retrying request {} : {} time", request.getRequestUri(), execCount); } return super.retryRequest(request, exception, execCount, context); @@ -72,9 +72,9 @@ public boolean retryRequest(HttpRequest request, IOException exception, int exec @Override public boolean retryRequest(HttpResponse response, int execCount, HttpContext context) { - if (execCount>=(maxRetries/2)) { + if (execCount >= (maxRetries / 2)) { LOG.warn("NVD API request failures are occurring; retrying request for the {} time", execCount); - } else { + } else if (execCount > 1) { LOG.debug("Retrying request {} time", execCount); } return super.retryRequest(response, execCount, context); @@ -88,7 +88,7 @@ public TimeValue getRetryInterval(final HttpResponse response, final int execCou } else { value = TimeValue.of(delay * execCount / 2, TimeUnit.MILLISECONDS); } - //check retry after header + // check retry after header final Header header = response.getFirstHeader(HttpHeaders.RETRY_AFTER); if (header != null) { TimeValue retryAfter = null;