Don't send health api request multiple time if fails
This commit is contained in:
@@ -122,15 +122,10 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
MAX_RETRIES=5 # Total attempts (1 initial + 4 retries)
|
echo "Waiting 1 minute before sending the health API request..."
|
||||||
RETRY_INTERVAL=10 # Retry every 10 seconds after first failure
|
sleep 60
|
||||||
|
|
||||||
echo "Waiting 1 minute before the first health check..."
|
|
||||||
sleep 60 # Initial wait before first attempt
|
|
||||||
|
|
||||||
for ((i=1; i<=$MAX_RETRIES; i++)); do
|
|
||||||
echo "Attempt $i/$MAX_RETRIES: Checking health API..."
|
|
||||||
|
|
||||||
|
echo "Checking health API..."
|
||||||
HEALTH_RESPONSE=$(curl -s 'http://localhost:3001/api/v1/health?force=true' \
|
HEALTH_RESPONSE=$(curl -s 'http://localhost:3001/api/v1/health?force=true' \
|
||||||
-H "Authorization: Bearer $API_KEY")
|
-H "Authorization: Bearer $API_KEY")
|
||||||
|
|
||||||
@@ -151,16 +146,10 @@ jobs:
|
|||||||
if [ "$WORKFLOWS_CREATE" = "true" ] && [ "$WORKFLOWS_RUN" = "true" ] && [ "$WORKFLOWS_RUN_FINISHED" = "true" ] && [ "$WORKFLOWS_RUN_STATUS" = "FINISHED" ] && [ "$WORKFLOWS_DELETE" = "true" ]; then
|
if [ "$WORKFLOWS_CREATE" = "true" ] && [ "$WORKFLOWS_RUN" = "true" ] && [ "$WORKFLOWS_RUN_FINISHED" = "true" ] && [ "$WORKFLOWS_RUN_STATUS" = "FINISHED" ] && [ "$WORKFLOWS_DELETE" = "true" ]; then
|
||||||
echo "Health endpoint check was successful."
|
echo "Health endpoint check was successful."
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
else
|
||||||
|
echo "Health check failed."
|
||||||
if [ "$i" -lt "$MAX_RETRIES" ]; then
|
|
||||||
echo "Health check failed. Retrying in $RETRY_INTERVAL seconds..."
|
|
||||||
sleep $RETRY_INTERVAL
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
echo "Health check failed after $MAX_RETRIES attempts."
|
|
||||||
exit 1
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
notify:
|
notify:
|
||||||
needs: build
|
needs: build
|
||||||
|
|||||||
Reference in New Issue
Block a user