Don't send health api request multiple time if fails
This commit is contained in:
@@ -122,15 +122,10 @@ jobs:
|
||||
exit 1
|
||||
fi
|
||||
|
||||
MAX_RETRIES=5 # Total attempts (1 initial + 4 retries)
|
||||
RETRY_INTERVAL=10 # Retry every 10 seconds after first failure
|
||||
|
||||
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 "Waiting 1 minute before sending the health API request..."
|
||||
sleep 60
|
||||
|
||||
echo "Checking health API..."
|
||||
HEALTH_RESPONSE=$(curl -s 'http://localhost:3001/api/v1/health?force=true' \
|
||||
-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
|
||||
echo "Health endpoint check was successful."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
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."
|
||||
else
|
||||
echo "Health check failed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
notify:
|
||||
needs: build
|
||||
|
||||
Reference in New Issue
Block a user