You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ri...@apache.org on 2022/03/01 15:19:52 UTC

[incubator-streampipes] branch rel/0.69.0 updated: [hotfix] Delay installation in case endpoints are not yet running

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

riemer pushed a commit to branch rel/0.69.0
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git


The following commit(s) were added to refs/heads/rel/0.69.0 by this push:
     new 03d2384  [hotfix] Delay installation in case endpoints are not yet running
03d2384 is described below

commit 03d238405226a80ffa51c89cb1eb6fbfbce4b67c
Author: Dominik Riemer <do...@gmail.com>
AuthorDate: Tue Mar 1 16:16:42 2022 +0100

    [hotfix] Delay installation in case endpoints are not yet running
---
 .../manager/setup/InstallationConfiguration.java       | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)

diff --git a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/InstallationConfiguration.java b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/InstallationConfiguration.java
index 7ada710..a6f9d5b 100644
--- a/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/InstallationConfiguration.java
+++ b/streampipes-pipeline-management/src/main/java/org/apache/streampipes/manager/setup/InstallationConfiguration.java
@@ -26,10 +26,13 @@ import org.slf4j.LoggerFactory;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.concurrent.TimeUnit;
 
 public class InstallationConfiguration {
 
 	private static final Logger LOG = LoggerFactory.getLogger(InstallationConfiguration.class);
+	private static final int MAX_RETRIES = 3;
+	private static final int SLEEP_TIME_SECONDS = 5;
 
 	public static List<InstallationStep> getInstallationSteps(InitialSettings settings)
 	{
@@ -44,7 +47,20 @@ public class InstallationConfiguration {
 						settings.getInitialAdminUserSid()));
 
 		if (settings.getInstallPipelineElements()) {
-			List<ExtensionsServiceEndpoint> endpoints = new EndpointFetcher().getEndpoints();
+			List<ExtensionsServiceEndpoint> endpoints;
+			int numberOfAttempts = 0;
+			do {
+				endpoints = new EndpointFetcher().getEndpoints();
+				numberOfAttempts++;
+				if (endpoints.size() == 0) {
+					LOG.info("Found 0 endpoints - waiting {} seconds to make sure all endpoints have properly started", SLEEP_TIME_SECONDS);
+					try {
+						TimeUnit.SECONDS.sleep(SLEEP_TIME_SECONDS);
+					} catch (InterruptedException e) {
+						e.printStackTrace();
+					}
+				}
+			} while (endpoints.size() == 0 && numberOfAttempts < MAX_RETRIES);
 			LOG.info("Found {} endpoints from which we will install extensions.", endpoints.size());
 			LOG.info("Further available extensions can always be installed by navigating to the 'Install pipeline elements' view");
 			for (ExtensionsServiceEndpoint endpoint : endpoints) {