diff --git a/plugin/src/main/java/org/opensearch/ml/model/MLModelCacheHelper.java b/plugin/src/main/java/org/opensearch/ml/model/MLModelCacheHelper.java index 554065ed95..680524324d 100644 --- a/plugin/src/main/java/org/opensearch/ml/model/MLModelCacheHelper.java +++ b/plugin/src/main/java/org/opensearch/ml/model/MLModelCacheHelper.java @@ -436,10 +436,7 @@ public void setModelInfo(String modelId, MLModel mlModel) { } public MLModel getModelInfo(String modelId) { - MLModelCache mlModelCache = modelCaches.get(modelId); - if (mlModelCache == null) { - return null; - } + MLModelCache mlModelCache = getExistingModelCache(modelId); return mlModelCache.getCachedModelInfo(); }