Skip to content

Commit

Permalink
Update check_domains.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
glenn-jocher authored Nov 21, 2024
1 parent fd7853c commit 63867d9
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions .github/workflows/check_domains.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,37 +65,38 @@ jobs:
run: |
import requests
import time
def check_domain_redirection(domain, prefix, max_attempts=3):
"""Check if the given domain redirects correctly, with delays between retries."""
valid_destinations = ["ultralytics.com", "yolo11.com"]
url = f"https://{prefix}{domain}"
print(f"\nChecking {url}")
for attempt in range(max_attempts):
try:
if attempt > 0:
time.sleep(2) # Simple 2-second delay between retries
delay = 2 ** attempt # 2, 4, 8 seconds...
time.sleep(delay)
response = requests.get(url, allow_redirects=True, timeout=10)
response.raise_for_status()
if any(dest in response.url for dest in valid_destinations) and response.status_code == 200:
print("Success ✅")
return True
except requests.RequestException as e:
print(f"Error: {e}")
if attempt == max_attempts - 1:
print(f"Failed after {max_attempts} attempts ❌")
return False
return False
success = check_domain_redirection('${{ matrix.domain }}', '${{ matrix.prefix }}')
if not success:
raise Exception(f"Domain check failed for ${{ matrix.domain }} with prefix '${{ matrix.prefix }}'")
Summary:
runs-on: ubuntu-latest
needs: [Test]
Expand Down

0 comments on commit 63867d9

Please sign in to comment.