From 9cf30a14861d494945e6b935cc3340a94e5464fe Mon Sep 17 00:00:00 2001 From: Mariano De Maio Date: Fri, 13 Oct 2023 10:28:54 -0300 Subject: [PATCH] QueryingServerHelper retry changes (#389) * CQL issue with connection pool exhaustion * RAD-630 update to QueryingServerHelper to handle retries better --- fhir-helpers/pom.xml | 2 +- fhir-query-helper-base/pom.xml | 2 +- .../java/io/elimu/a2d2/cds/fhir/helper/FetchCallRetry.java | 5 ++++- fhir-query-helper-dstu2/pom.xml | 2 +- fhir-query-helper-dstu3/pom.xml | 2 +- fhir-query-helper-r4/pom.xml | 2 +- oauth-helpers/pom.xml | 2 +- pom.xml | 2 +- 8 files changed, 11 insertions(+), 8 deletions(-) diff --git a/fhir-helpers/pom.xml b/fhir-helpers/pom.xml index 542079cc..03b2c50d 100644 --- a/fhir-helpers/pom.xml +++ b/fhir-helpers/pom.xml @@ -20,7 +20,7 @@ 4.0.0 io.elimu.a2d2 fhir-helpers - 0.0.16 + 0.0.17 jar fhir-helpers http://maven.apache.org diff --git a/fhir-query-helper-base/pom.xml b/fhir-query-helper-base/pom.xml index b56510e0..e6a6f968 100644 --- a/fhir-query-helper-base/pom.xml +++ b/fhir-query-helper-base/pom.xml @@ -27,7 +27,7 @@ fhir-query-helper-base - 0.0.16 + 0.0.17 CDS Helper base diff --git a/fhir-query-helper-base/src/main/java/io/elimu/a2d2/cds/fhir/helper/FetchCallRetry.java b/fhir-query-helper-base/src/main/java/io/elimu/a2d2/cds/fhir/helper/FetchCallRetry.java index e2790808..2c511151 100644 --- a/fhir-query-helper-base/src/main/java/io/elimu/a2d2/cds/fhir/helper/FetchCallRetry.java +++ b/fhir-query-helper-base/src/main/java/io/elimu/a2d2/cds/fhir/helper/FetchCallRetry.java @@ -35,11 +35,14 @@ public T retryRestCall(FhirClientWrapper client) { log.info("FHIR REST call failed attempt number " + count + " with status " + client.getTracker().getResponseStatusCode() + ". Retrying after waiting " + (delay * count) + "ms"); count++; } catch (Throwable t) { + if (client.getTracker().getResponseStatusCode() >= 0 && client.getTracker().getResponseStatusCode() < 500) { + throw new RuntimeException("Invocation of call failed with status code " + client.getTracker().getResponseStatusCode() + ". No further retries will be performed"); + } count++; // and retry log.warn("FHIR REST call failed attempt number " + count + " with status " + client.getTracker().getResponseStatusCode() + " and error. Retrying after waiting " + (delay * count) + "ms", t); } } - throw new RuntimeException("After " + count + " retries, invocation of clal still failed"); + throw new RuntimeException("After " + count + " retries, invocation of call still failed"); } public int getDelay(int count, int delay) { diff --git a/fhir-query-helper-dstu2/pom.xml b/fhir-query-helper-dstu2/pom.xml index 2b1ec75f..2589ac75 100644 --- a/fhir-query-helper-dstu2/pom.xml +++ b/fhir-query-helper-dstu2/pom.xml @@ -25,7 +25,7 @@ fhir-query-helper-dstu2 - 0.0.16 + 0.0.17 jar CDS Helper diff --git a/fhir-query-helper-dstu3/pom.xml b/fhir-query-helper-dstu3/pom.xml index 6b4756df..a643923d 100644 --- a/fhir-query-helper-dstu3/pom.xml +++ b/fhir-query-helper-dstu3/pom.xml @@ -26,7 +26,7 @@ fhir-query-helper-dstu3 - 0.0.16 + 0.0.17 jar CDS Helper DSTU3 diff --git a/fhir-query-helper-r4/pom.xml b/fhir-query-helper-r4/pom.xml index b510a615..9c25817a 100644 --- a/fhir-query-helper-r4/pom.xml +++ b/fhir-query-helper-r4/pom.xml @@ -26,7 +26,7 @@ fhir-query-helper-r4 - 0.0.16 + 0.0.17 jar CDS Helper R4 diff --git a/oauth-helpers/pom.xml b/oauth-helpers/pom.xml index 037ff818..c1771137 100644 --- a/oauth-helpers/pom.xml +++ b/oauth-helpers/pom.xml @@ -27,7 +27,7 @@ oauth-helpers - 0.0.16 + 0.0.17 OAuth Helper diff --git a/pom.xml b/pom.xml index 0e9d0c5c..10f0a926 100644 --- a/pom.xml +++ b/pom.xml @@ -23,7 +23,7 @@ 3.21.8 2.23.0 4.0.1 - 0.0.16 + 0.0.17 2.3.30 0.8.7 2.3.1