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)) {