From 1dbfffa2c871b8b434d8d65ec17a980fe3234b0b Mon Sep 17 00:00:00 2001 From: Graham Triggs Date: Thu, 18 Aug 2016 06:59:13 -0600 Subject: [PATCH] [VIVO-1262] Minor correction in the visualisation cache --- .../utilities/CachingRDFServiceExecutor.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/api/src/main/java/edu/cornell/mannlib/vitro/webapp/visualization/utilities/CachingRDFServiceExecutor.java b/api/src/main/java/edu/cornell/mannlib/vitro/webapp/visualization/utilities/CachingRDFServiceExecutor.java index b2265510..d10e262e 100644 --- a/api/src/main/java/edu/cornell/mannlib/vitro/webapp/visualization/utilities/CachingRDFServiceExecutor.java +++ b/api/src/main/java/edu/cornell/mannlib/vitro/webapp/visualization/utilities/CachingRDFServiceExecutor.java @@ -90,11 +90,16 @@ public class CachingRDFServiceExecutor { if (cachedResults != null) { // If the background service exists, and the cache is considered invalid if (backgroundRDFService != null && resultBuilder.invalidateCache(System.currentTimeMillis() - lastCacheTime)) { - // Determine how long we are prepared to wait for an answer - long waitFor = (backgroundTask == null ? 1000 : 500); + // In most cases, only wait for half a second + long waitFor = 500; - // Start the background task to refresh the cache - startBackgroundTask(rdfService); + if (backgroundTask == null) { + // Start the background task to refresh the cache + startBackgroundTask(backgroundRDFService); + + // As we've just started the background task, allow a wait time of 1 second + waitFor = 1000; + } // See if we expect it to complete in time, and if so, wait for it if (allowWaits && isExpectedToCompleteIn(waitFor)) {