Skip to content

fix: retry sitemap fetching on error and raise when retries are exhausted#1943

Open
vdusek wants to merge 1 commit into
masterfrom
fix/sitemap-fetch-retries
Open

fix: retry sitemap fetching on error and raise when retries are exhausted#1943
vdusek wants to merge 1 commit into
masterfrom
fix/sitemap-fetch-retries

Conversation

@vdusek
Copy link
Copy Markdown
Collaborator

@vdusek vdusek commented Jun 3, 2026

Description

The try/except in _fetch_and_process_sitemap wrapped the entire while retries_left > 0 loop instead of the loop body. Any exception raised while streaming a sitemap therefore exited the loop after a single attempt, logged a warning, and silently ended the async generator — no retry ever happened, sitemap_retries was effectively dead code, and callers (Sitemap.load, parse_sitemap, SitemapRequestLoader) saw empty or partial results with no error.

This PR moves the try/except inside the loop body so each attempt is independently retried, and raises the error once all retries are exhausted instead of swallowing it.

Behavior notes

  • A sitemap that keeps failing after all retries now raises to the caller instead of silently producing empty results. SitemapRequestLoader already logs and propagates this via its own error handling.
  • If a stream fails after yielding some items, the retry re-fetches the sitemap from scratch, so items yielded before the failure may be yielded again. This is pre-existing streaming-generator semantics, now just reachable via the (working) retry path.

…sted

The try/except in _fetch_and_process_sitemap wrapped the whole retry
loop instead of its body, so any fetch error exited the loop after a
single attempt and was silently swallowed, leaving callers with empty
or partial results. Each attempt is now independently retried and the
error is raised once all retries are exhausted.
@vdusek vdusek added t-tooling Issues with this label are in the ownership of the tooling team. adhoc Ad-hoc unplanned task added during the sprint. labels Jun 3, 2026
@vdusek vdusek self-assigned this Jun 3, 2026
@github-actions github-actions Bot added this to the 142nd sprint - Tooling team milestone Jun 3, 2026
@github-actions github-actions Bot added the tested Temporary label used only programatically for some analytics. label Jun 3, 2026
@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 3, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.97%. Comparing base (dc1ed61) to head (385a6b4).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1943      +/-   ##
==========================================
+ Coverage   92.85%   92.97%   +0.12%     
==========================================
  Files         167      167              
  Lines       11714    11716       +2     
==========================================
+ Hits        10877    10893      +16     
+ Misses        837      823      -14     
Flag Coverage Δ
unit 92.97% <100.00%> (+0.12%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@vdusek vdusek requested a review from Mantisus June 3, 2026 18:04
@vdusek vdusek marked this pull request as ready for review June 3, 2026 18:04
Copy link
Copy Markdown
Collaborator

@Mantisus Mantisus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

adhoc Ad-hoc unplanned task added during the sprint. t-tooling Issues with this label are in the ownership of the tooling team. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants