From 7594a723c69036a79a64f13861dd8c9e3879bc43 Mon Sep 17 00:00:00 2001 From: Yves Gugger Date: Wed, 17 Dec 2025 08:19:48 +0100 Subject: [PATCH] Fix: Retry when downloaded CZDS file not found Previously, if download succeeded but file wasn't found, function returned None immediately. Now raises FileNotFoundError to trigger the retry logic properly. --- backend/scripts/sync_all_zones.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/backend/scripts/sync_all_zones.py b/backend/scripts/sync_all_zones.py index f408219..986b700 100644 --- a/backend/scripts/sync_all_zones.py +++ b/backend/scripts/sync_all_zones.py @@ -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}")