Skip to content

Commit 38d7581

Browse files
authored
Improve domain check retry robustness (#296)
1 parent d6ee6a9 commit 38d7581

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

.github/workflows/check_domains.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
runs-on: ubuntu-latest
1919
strategy:
2020
fail-fast: false
21+
max-parallel: 10
2122
matrix:
2223
domain:
2324
[
@@ -74,21 +75,21 @@ jobs:
7475
import time
7576
7677
def check_domain_redirection(domain, prefix, max_attempts=5):
77-
"""Check if the given domain redirects correctly, with delays between retries."""
78+
"""Check if the given domain redirects correctly, with exponential delays between retries."""
7879
valid_destinations = ["ultralytics.com", "yolo11.com"]
7980
url = f"https://{prefix}{domain}"
8081
print(f"\nChecking {url}")
8182
8283
for attempt in range(max_attempts):
8384
try:
8485
if attempt > 0:
85-
delay = 2 ** attempt # 2, 4, 8, 16, 32 seconds...
86+
delay = min(10 * (2 ** attempt), 160) # 20, 40, 80, 160...
87+
print(f"Retrying in {delay}s (attempt {attempt + 1}/{max_attempts})")
8688
time.sleep(delay)
8789
8890
response = requests.get(url, allow_redirects=True, timeout=10)
8991
response.raise_for_status()
9092
91-
# Check if the final URL contains any of the valid destinations
9293
if any(dest in response.url for dest in valid_destinations) and response.status_code == 200:
9394
print("Success ✅")
9495
return True

0 commit comments

Comments
 (0)