fix(ci): mmdb curl retry up to 5 mins (#34390)

This commit is contained in:
Joshua Snyder
2025-07-01 12:13:56 +02:00
committed by GitHub
parent 28c120d87a
commit 3bef2cd83f
2 changed files with 16 additions and 18 deletions

View File

@@ -3,7 +3,6 @@ set -o pipefail
set -e
# Get dir of this script
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
mkdir -p "$DIR/../share"
@@ -11,22 +10,21 @@ mkdir -p "$DIR/../share"
if [ ! -f "$DIR/../share/GeoLite2-City.mmdb" ] || [ ! -f "$DIR/../share/GeoLite2-City.json" ]; then
rm -f "$DIR/../share/GeoLite2-City.mmdb" "$DIR/../share/GeoLite2-City.json"
# Try up to 3 times since this download is flaky
for attempt in 1 2 3; do
echo "Downloading GeoLite2-City.mmdb (attempt $attempt/3)..."
if curl -L "https://mmdbcdn.posthog.net/" --http1.1 --fail | brotli --decompress --output="$DIR/../share/GeoLite2-City.mmdb"; then
echo "Download successful"
break
fi
echo "Download failed"
if [ $attempt -eq 3 ]; then
echo "Failed after 3 attempts"
exit 1
fi
echo "Retrying in 5 seconds..."
sleep 5
done
echo "Downloading GeoLite2-City.mmdb..."
if curl -L "https://mmdbcdn.posthog.net/" \
--http1.1 \
--fail \
--retry 10 \
--retry-max-time 300 \
--retry-all-errors \
--progress-bar \
--show-error |
brotli --decompress --output="$DIR/../share/GeoLite2-City.mmdb"; then
echo "Download successful"
else
echo "Download failed after retries"
exit 1
fi
DATE=$(date +"%Y-%m-%d")
echo "{ \"date\": \"$DATE\" }" >"$DIR/../share/GeoLite2-City.json"

View File

@@ -51,7 +51,7 @@ class SetupWizardViewSet(viewsets.ViewSet):
@action(methods=["POST"], detail=False, url_path="initialize")
def initialize(self, request: Request) -> Response:
"""
This endpoint is used to initialize the setup wizard. It creates a unique hash for the user to authenticate.
This endpoint is used to initialize the setup wizard. It creates a unique hash for the user to authenticate themselves.
"""
serializer = SetupWizardSerializer()