From 92930ac71798e8110f1fcd4e94c2458017f84677 Mon Sep 17 00:00:00 2001 From: Deeman Date: Sun, 1 Mar 2026 21:25:09 +0100 Subject: [PATCH] =?UTF-8?q?fix(extract):=20handle=200-result=20recheck=20g?= =?UTF-8?q?racefully=20=E2=80=94=20skip=20file=20write?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When all proxy tiers are exhausted and 0 venues are fetched, the working file is empty and compress_jsonl_atomic asserts non-empty. Return early with a warning instead of crashing. Co-Authored-By: Claude Sonnet 4.6 --- .../src/padelnomics_extract/playtomic_availability.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/extract/padelnomics_extract/src/padelnomics_extract/playtomic_availability.py b/extract/padelnomics_extract/src/padelnomics_extract/playtomic_availability.py index 2ad1cea..0b45aa5 100644 --- a/extract/padelnomics_extract/src/padelnomics_extract/playtomic_availability.py +++ b/extract/padelnomics_extract/src/padelnomics_extract/playtomic_availability.py @@ -522,6 +522,10 @@ def extract_recheck( dest_dir = landing_path(landing_dir, "playtomic", year, month) dest = dest_dir / f"availability_{target_date}_recheck_{recheck_hour:02d}.jsonl.gz" + if not venues_data: + logger.warning("Recheck fetched 0 venues (%d errors) — skipping file write", venues_errored) + return {"files_written": 0, "files_skipped": 0, "bytes_written": 0} + captured_at = datetime.now(UTC).strftime("%Y-%m-%dT%H:%M:%SZ") working_path = dest.with_suffix("").with_suffix(".working.jsonl") with open(working_path, "w") as f: