handle tx ecosystem failure properly

This commit is contained in:
Grahame Grieve 2025-01-04 10:29:56 +11:00
parent 2c359f64f9
commit 6ab2bb518d
1 changed files with 38 additions and 19 deletions

View File

@ -160,6 +160,8 @@ public class TerminologyClientManager {
private ILoggingService logger;
private int ecosystemfailCount;
public TerminologyClientManager(ITerminologyClientFactory factory, String cacheId, ILoggingService logger) {
super();
this.factory = factory;
@ -566,6 +568,8 @@ public class TerminologyClientManager {
if (!useEcosystem) {
server = getMasterClient().getAddress();
} else {
ecosystemfailCount = 0;
try {
if (usage != null) {
request = request + "&usage="+usage;
}
@ -589,6 +593,21 @@ public class TerminologyClientManager {
} catch (MalformedURLException e) {
}
}
} catch (Exception e) {
// the ecosystem cal failed, so we're just going to fall back to
String msg = "Error resolving valueSet "+canonical+": "+e.getMessage();
if (!hasMessage(msg)) {
internalLog.add(new InternalLogEvent(msg, canonical, request));
}
if (logger.isDebugLogging()) {
e.printStackTrace();
}
ecosystemfailCount++;
if (ecosystemfailCount > 3) {
useEcosystem = false;
}
server = getMasterClient().getAddress();
}
}
TerminologyClientContext client = serverMap.get(server);
if (client == null) {