From 5b7a121017fe996b887bbf79d2283c1a037df191 Mon Sep 17 00:00:00 2001 From: Jeremy Long Date: Fri, 24 Nov 2023 11:21:53 -0500 Subject: [PATCH] fix: improve end user warning --- .../client/nvd/NvdApiRetryStrategy.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 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 29d18400..5322b3c2 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,13 +62,21 @@ public NvdApiRetryStrategy(int maxRetries, long delay) { @Override public boolean retryRequest(HttpRequest request, IOException exception, int execCount, HttpContext context) { - LOG.debug("Retrying request {} : {} time", request.getRequestUri(), execCount); + if (execCount>=(maxRetries/2)) { + LOG.warn("NVD API request failures are occurring; retrying request for the {} time", execCount); + } else { + LOG.debug("Retrying request {} : {} time", request.getRequestUri(), execCount); + } return super.retryRequest(request, exception, execCount, context); } @Override public boolean retryRequest(HttpResponse response, int execCount, HttpContext context) { - LOG.debug("Retrying request {} time", execCount); + if (execCount>=(maxRetries/2)) { + LOG.warn("NVD API request failures are occurring; retrying request for the {} time", execCount); + } else { + LOG.debug("Retrying request {} time", execCount); + } return super.retryRequest(response, execCount, context); }