diff --git a/backend/src/cyclone/rebill/spot_check_validate.py b/backend/src/cyclone/rebill/spot_check_validate.py index a2b50db..9ed7f12 100644 --- a/backend/src/cyclone/rebill/spot_check_validate.py +++ b/backend/src/cyclone/rebill/spot_check_validate.py @@ -74,9 +74,18 @@ def validate_spot_check_files(paths: list[Path]) -> list[dict]: This module never silently substitutes a different validator. """ + import time out: list[dict] = [] - for p in paths: + for i, p in enumerate(paths): body = p.read_bytes() + # The Edifabric /v2/x12 endpoints apply a per-second rate limit + # in addition to the daily quota (typical: 1 call/sec sustained, + # 429 if exceeded). Insert a 1.5s pause between calls so 10-file + # spot-checks don't trip the limit; this is the value the plan + # flagged ("1-2 s spacing") that the original monolithic scratch + # driver skipped. + if i > 0: + time.sleep(1.5) try: result = validate_edi(body) except EdifabricError as exc: