From 2748592130f88f39387e30b5bd776b6e01362f59 Mon Sep 17 00:00:00 2001 From: "stuart.woodman" Date: Wed, 6 Dec 2023 14:24:10 +1100 Subject: [PATCH] KnownLayers build will be triggered immediately after CSW caching. --- .../auscope/portal/core/services/CSWCacheService.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/main/java/org/auscope/portal/core/services/CSWCacheService.java b/src/main/java/org/auscope/portal/core/services/CSWCacheService.java index 092b1f67f..a83fb724b 100644 --- a/src/main/java/org/auscope/portal/core/services/CSWCacheService.java +++ b/src/main/java/org/auscope/portal/core/services/CSWCacheService.java @@ -31,6 +31,8 @@ import org.auscope.portal.core.services.responses.csw.CSWRecordTransformerFactory; import org.auscope.portal.core.util.FileIOUtil; import org.objenesis.strategy.StdInstantiatorStrategy; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Lazy; import com.esotericsoftware.kryo.Kryo; @@ -84,6 +86,11 @@ public class CSWCacheService { /** If true, this class will force the usage of HTTP GetMethods instead of POST methods (where possible). Useful workaround for some CSW services */ protected boolean forceGetMethods = false; protected Date lastCacheUpdate; + + // KnownLayerService needs to be informed when indexing is finished, must be @Lazy loaded to avoid circular dependencies + @Autowired + @Lazy + private KnownLayerService knownLayerService; /** * Creates a new instance of a CSWKeywordCacheService. This constructor is normally autowired by the spring framework. @@ -257,6 +264,10 @@ private synchronized void updateFinished(Map> newKeywordC this.keywordsByRegistry = newKeywordByEndpointCache; } saveCacheToFile(); + + // Inform KnownLayerService that there are potentially new CSWRecords + knownLayerService.updateKnownLayersCache(); + this.updateRunning = false; this.lastCacheUpdate = new Date();