Fix: Retry when downloaded CZDS file not found
Some checks failed
CI / Frontend Lint & Type Check (push) Has been cancelled
CI / Frontend Build (push) Has been cancelled
CI / Backend Lint (push) Has been cancelled
CI / Backend Tests (push) Has been cancelled
CI / Docker Build (push) Has been cancelled
CI / Security Scan (push) Has been cancelled
Deploy / Build & Push Images (push) Has been cancelled
Deploy / Deploy to Server (push) Has been cancelled
Deploy / Notify (push) Has been cancelled

Previously, if download succeeded but file wasn't found, function
returned None immediately. Now raises FileNotFoundError to trigger
the retry logic properly.
This commit is contained in:
2025-12-17 08:19:48 +01:00
parent 006407ca1d
commit 7594a723c6

View File

@ -140,11 +140,12 @@ def download_czds_zone(tld: str, max_retries: int = 3) -> Optional[Path]:
if gz_file.exists():
return gz_file
# Try alternative naming
# Try alternative naming (pyCZDS sometimes uses different names)
for f in CZDS_DIR.glob(f"*{tld}*.gz"):
return f
return None
# File not found after download - raise exception to trigger retry
raise FileNotFoundError(f"Downloaded file not found for .{tld} in {CZDS_DIR}")
except Exception as e:
logger.warning(f"CZDS download attempt {attempt + 1} failed for .{tld}: {e}")