diff --git a/ml-algorithms/src/main/java/org/opensearch/ml/engine/encryptor/EncryptorImpl.java b/ml-algorithms/src/main/java/org/opensearch/ml/engine/encryptor/EncryptorImpl.java index 617c6871e5..58081a05af 100644 --- a/ml-algorithms/src/main/java/org/opensearch/ml/engine/encryptor/EncryptorImpl.java +++ b/ml-algorithms/src/main/java/org/opensearch/ml/engine/encryptor/EncryptorImpl.java @@ -125,7 +125,10 @@ private void initMasterKey() { } try { - latch.await(5, SECONDS); + boolean completed = latch.await(3, SECONDS); + if (!completed) { + throw new MLException("Fetching master key timed out."); + } } catch (InterruptedException e) { throw new IllegalStateException(e); }