From 998732a6bbe584d72325581f4450d8821873384e Mon Sep 17 00:00:00 2001 From: hiroTochigi Date: Fri, 20 Sep 2024 21:28:01 -0500 Subject: [PATCH] feat: Increase wait time for conditional output in utilityFunction.sh The wait time for conditional output in the `utilityFunction.sh` file has been increased from 5 seconds to 10 seconds. This change ensures that the condition is given enough time to be met before proceeding. --- src/aws/dependencies/utilitiyFunction.sh | 2 +- src/aws/up.sh | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/aws/dependencies/utilitiyFunction.sh b/src/aws/dependencies/utilitiyFunction.sh index 7284740..1b2d7aa 100644 --- a/src/aws/dependencies/utilitiyFunction.sh +++ b/src/aws/dependencies/utilitiyFunction.sh @@ -89,7 +89,7 @@ function waitForConditionalOutput() { fi fi attempt=$((attempt + 1)) - sleep 5 + sleep 10 done echo "Error: Failed to meet the condition after $maxAttempts attempts." diff --git a/src/aws/up.sh b/src/aws/up.sh index 19cf2a8..668cb0e 100644 --- a/src/aws/up.sh +++ b/src/aws/up.sh @@ -191,7 +191,11 @@ function up { if [ -z "$instanceId" ]; then createAndTagInstance else - instanceState=$(checkInstanceState $instanceId) + instanceState=$(waitForConditionalOutput "checkInstanceState $instanceId" "\"stopping\"" "different") + if [ $? -ne 0 ]; then + echo "Wait for starting on start command until instance is stopped." + exit 1 + fi case "$instanceState" in "running")