fix(extract): handle 0-result recheck gracefully — skip file write

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 <noreply@anthropic.com>
This commit is contained in:
Deeman
2026-03-01 21:25:09 +01:00
parent 0811b30cbd
commit 92930ac717

View File

@@ -522,6 +522,10 @@ def extract_recheck(
dest_dir = landing_path(landing_dir, "playtomic", year, month) dest_dir = landing_path(landing_dir, "playtomic", year, month)
dest = dest_dir / f"availability_{target_date}_recheck_{recheck_hour:02d}.jsonl.gz" 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") captured_at = datetime.now(UTC).strftime("%Y-%m-%dT%H:%M:%SZ")
working_path = dest.with_suffix("").with_suffix(".working.jsonl") working_path = dest.with_suffix("").with_suffix(".working.jsonl")
with open(working_path, "w") as f: with open(working_path, "w") as f: