Set error cacheing via system property

This commit is contained in:
dotasek 2021-12-13 12:57:37 -05:00
parent 3b58aef820
commit 11503115df
3 changed files with 12 additions and 4 deletions

View File

@ -899,7 +899,7 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
if (code.hasSystem()) { if (code.hasSystem()) {
codeSystemsUsed.add(code.getSystem()); codeSystemsUsed.add(code.getSystem());
} }
CacheToken cacheToken = txCache != null ? txCache.generateValidationToken(options, code, vs) : null; final CacheToken cacheToken = txCache != null ? txCache.generateValidationToken(options, code, vs) : null;
ValidationResult res = null; ValidationResult res = null;
if (txCache != null) { if (txCache != null) {
res = txCache.getValidation(cacheToken); res = txCache.getValidation(cacheToken);
@ -948,14 +948,15 @@ public abstract class BaseWorkerContext extends I18nBase implements IWorkerConte
if (options.isGuessSystem()) { if (options.isGuessSystem()) {
pIn.addParameter().setName("implySystem").setValue(new BooleanType(true)); pIn.addParameter().setName("implySystem").setValue(new BooleanType(true));
} }
setTerminologyOptions(options, pIn);res = validateOnServer(vs, pIn, options); setTerminologyOptions(options, pIn);
res = validateOnServer(vs, pIn, options);
} catch (Exception e) { } catch (Exception e) {
res = new ValidationResult(IssueSeverity.ERROR, e.getMessage() == null ? e.getClass().getName() : e.getMessage()).setTxLink(txLog == null ? null : txLog.getLastId()).setErrorClass(TerminologyServiceErrorClass.SERVER_ERROR); res = new ValidationResult(IssueSeverity.ERROR, e.getMessage() == null ? e.getClass().getName() : e.getMessage()).setTxLink(txLog == null ? null : txLog.getLastId()).setErrorClass(TerminologyServiceErrorClass.SERVER_ERROR);
} }
if (res.getErrorClass() == TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED && !code.hasVersion()) { if (res.getErrorClass() == TerminologyServiceErrorClass.CODESYSTEM_UNSUPPORTED && !code.hasVersion()) {
unsupportedCodeSystems.add(codeKey); unsupportedCodeSystems.add(codeKey);
} }
if (txCache != null) { // we never cache unsuppoted code systems - we always keep trying (but only once per run) if (txCache != null) { // we never cache unsupported code systems - we always keep trying (but only once per run)
txCache.cacheValidation(cacheToken, res, TerminologyCache.PERMANENT); txCache.cacheValidation(cacheToken, res, TerminologyCache.PERMANENT);
} }
return res; return res;

View File

@ -126,7 +126,8 @@ public class TerminologyCache {
static { static {
String cacheErrorsProperty = System.getProperty("cacheErrors"); String cacheErrorsProperty = System.getProperty("cacheErrors");
cacheErrors = true;//cacheErrorsProperty != null ? "TRUE".equals(cacheErrorsProperty.toUpperCase(Locale.ROOT)) : false; cacheErrors = cacheErrorsProperty != null ? "TRUE".equals(cacheErrorsProperty.toUpperCase(Locale.ROOT)) : false;
System.out.println();
} }
// use lock from the context // use lock from the context

View File

@ -377,6 +377,9 @@
<excludes> <excludes>
<exclude>org/hl7/fhir/validation/cli/**</exclude> <exclude>org/hl7/fhir/validation/cli/**</exclude>
</excludes> </excludes>
<systemPropertyVariables>
<cacheErrors>TRUE</cacheErrors>
</systemPropertyVariables>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>
@ -406,6 +409,9 @@
<excludes> <excludes>
<exclude>org/hl7/fhir/validation/cli/**</exclude> <exclude>org/hl7/fhir/validation/cli/**</exclude>
</excludes> </excludes>
<systemPropertyVariables>
<cacheErrors>TRUE</cacheErrors>
</systemPropertyVariables>
</configuration> </configuration>
</plugin> </plugin>
</plugins> </plugins>