Skip to content

Commit 122a368

Browse files
committed
feat: add request throttling to redirect validation script
1 parent 8d3f17e commit 122a368

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

scripts/validate-redirects.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424
import sys
2525
import textwrap
2626
from pathlib import Path
27+
import time
2728
from typing import Iterable
2829
from urllib.parse import urljoin
2930

@@ -124,6 +125,8 @@ def main() -> None:
124125

125126
failures: list[str] = []
126127
for idx, entry in slice_iter(redirects, args.start, end):
128+
# Throttle requests so we don't hammer the site
129+
time.sleep(0.1)
127130
old = entry["old"]
128131
status, location = check_redirect(args.base_url, old)
129132
print(f"[DEBUG] ({idx}) status={status}, location='{location}'")

0 commit comments

Comments
 (0)