From 52a1d4fa74efa96e527d95eca0dd7075d9edf028 Mon Sep 17 00:00:00 2001 From: Mario Rodriguez Molins Date: Thu, 8 Feb 2024 19:21:37 +0100 Subject: [PATCH] Add sleep before retrying stack up again (#1665) --- internal/stack/boot.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/internal/stack/boot.go b/internal/stack/boot.go index 6c66e5f17..c4f66457e 100644 --- a/internal/stack/boot.go +++ b/internal/stack/boot.go @@ -9,6 +9,7 @@ import ( "os" "path/filepath" "strings" + "time" "github.com/elastic/elastic-package/internal/builder" "github.com/elastic/elastic-package/internal/configuration/locations" @@ -91,7 +92,9 @@ func BootUp(options Options) error { // As a workaround, try to give another chance to docker-compose if only // elastic-agent failed. if onlyElasticAgentFailed(options) { - fmt.Println("Elastic Agent failed to start, trying again.") + sleepTime := 10 * time.Second + fmt.Printf("Elastic Agent failed to start, trying again in %s.\n", sleepTime) + time.Sleep(sleepTime) err = dockerComposeUp(options) } if err != nil {