This is an automated email from the ASF dual-hosted git repository.

shuber pushed a commit to branch opensearch-persistence
in repository https://gitbox.apache.org/repos/asf/unomi.git


The following commit(s) were added to refs/heads/opensearch-persistence by this 
push:
     new 6a1208962 Added a maximum number of retries to address issued raised 
during code review.
6a1208962 is described below

commit 6a12089628be7c20e914f9c8d4bb0b2ac1cda1d2
Author: Serge Huber <[email protected]>
AuthorDate: Mon Oct 13 19:35:53 2025 +0200

    Added a maximum number of retries to address issued raised during code 
review.
---
 itests/src/test/java/org/apache/unomi/itests/BaseIT.java | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)

diff --git a/itests/src/test/java/org/apache/unomi/itests/BaseIT.java 
b/itests/src/test/java/org/apache/unomi/itests/BaseIT.java
index 15b2228f7..328ceac0e 100644
--- a/itests/src/test/java/org/apache/unomi/itests/BaseIT.java
+++ b/itests/src/test/java/org/apache/unomi/itests/BaseIT.java
@@ -220,12 +220,22 @@ public abstract class BaseIT extends KarafTestSupport {
     }
 
     private void waitForUnomiManagementService() throws InterruptedException {
+        final int maxRetries = 5;
+        int retryCount = 0;
         UnomiManagementService unomiManagementService = 
getOsgiService(UnomiManagementService.class, 600000);
-        while (unomiManagementService == null) {
-            LOGGER.info("Waiting for Unomi Management Service to be 
available...");
+
+        while (unomiManagementService == null && retryCount < maxRetries) {
+            LOGGER.info("Waiting for Unomi Management Service to be 
available... (attempt {}/{})", retryCount + 1, maxRetries);
             Thread.sleep(1000);
+            retryCount++;
             unomiManagementService = 
getOsgiService(UnomiManagementService.class, 600000);
         }
+
+        if (unomiManagementService == null) {
+            String errorMsg = String.format("Unomi Management Service was not 
available after %d retries.", maxRetries);
+            LOGGER.error(errorMsg);
+            throw new InterruptedException(errorMsg);
+        }
     }
 
     @After

Reply via email to