diff --git a/src/main/java/com/ibm/watson/modelmesh/ModelMesh.java b/src/main/java/com/ibm/watson/modelmesh/ModelMesh.java index 1af0e83b..c8c9cd65 100644 --- a/src/main/java/com/ibm/watson/modelmesh/ModelMesh.java +++ b/src/main/java/com/ibm/watson/modelmesh/ModelMesh.java @@ -268,6 +268,8 @@ public abstract class ModelMesh extends ThriftService // time before which we don't wait for migrated models to load elsewhere during pre-shutdown protected static final long CUTOFF_AGE_MS = 60 * 60_000L; // 1 hour + protected static final long THREE_MINS_MS = 3 * 60_000L; + // max combined number of cache-hit/miss retries per request - mainly just a safeguard protected static final int MAX_ITERATIONS = 8; @@ -5936,7 +5938,7 @@ public void run() { } else { lastUsed = ce != null ? runtimeCache.getLastUsedTime(modelId) : -1L; // Use shorter expiry age if model was used in last 3 minutes - final long expiryAge = (lastUsed > 0 && (now - lastUsed) < 180_000L) + final long expiryAge = (lastUsed > 0 && (now - lastUsed) < THREE_MINS_MS) ? IN_USE_LOAD_FAILURE_EXPIRY_MS : LOAD_FAILURE_EXPIRY_MS; if (now - failedTime > expiryAge) { remFailed = true;