From 013d105de20a5100fda26d44e38bb465d9e2da2f Mon Sep 17 00:00:00 2001 From: Jing Zhang Date: Mon, 25 Nov 2024 12:29:49 -0800 Subject: [PATCH] [backport 2.14] increase the wait timeout to fetch the master key (#3151) (#3178) (#3213) * increase the wait timeout to fetch the master key (#3151) (#3178) * increase the wait timeout to fetch the master key Signed-off-by: Jing Zhang * fix UTs Signed-off-by: Jing Zhang --------- Signed-off-by: Jing Zhang * spotless Signed-off-by: Jing Zhang * fix UT Signed-off-by: Jing Zhang --------- Signed-off-by: Jing Zhang Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> --- .../org/opensearch/ml/engine/encryptor/EncryptorImpl.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); }