<?xml version="1.0" encoding="UTF-8"?>
<response><data><post><id>55</id><slug>retry-and-backoff-patterns-part-3-55</slug><title>Retry and backoff patterns, part 3</title><excerpt>Part 3 looks at what changes when the same technique has to run every day in production. Networks fail, servers restart and rate limits kick in. A scraper that gives up at the first error is fragile;…</excerpt><seriesName>Retry and backoff patterns</seriesName><seriesPart>3</seriesPart><sections><item><heading>Introduction</heading><paragraphs><item>Part 3 looks at what changes when the same technique has to run every day in production. Networks fail, servers restart and rate limits kick in. A scraper that gives up at the first error is fragile; one that retries instantly and forever is a nuisance.</item></paragraphs></item><item><heading>Step by step</heading><paragraphs><item>Treat HTTP 429 responses as a signal, not an obstacle. Read the Retry-After header, back off, and resume at a slower pace.</item><item>Deduplicate as you go. The same item often appears on several listing pages, and a stable identifier such as a SKU or ID makes duplicates easy to spot.</item><item>Be careful with relative URLs. Resolve every link against the page it came from, not against the site root, or you will request pages that do not exist.</item></paragraphs></item><item><heading>What to watch for</heading><paragraphs><item>Keep configuration such as base URLs, delays and selectors out of your code. Changing a delay should not require a redeploy.</item><item>Time zones matter more than they seem. Store timestamps in UTC and convert only when displaying them.</item><item>Always identify your client honestly with a descriptive User-Agent, and keep your request rate modest. A crawler that behaves like a considerate visitor is far less likely to cause problems for the site operator.</item></paragraphs></item><item><heading>Key takeaway</heading><paragraphs><item>Retry only on errors that can succeed later (timeouts, 429, 5xx), use exponential backoff with jitter, and cap the number of attempts.</item></paragraphs></item></sections><authorId>5</authorId><authorName>Chen Patel</authorName><authorSlug>chen-patel</authorSlug><category>Data Engineering</category><tags><item>selenium</item><item>playwright</item><item>json</item><item>ethics</item></tags><publishedAt>2023-11-24T00:00:00.000Z</publishedAt><wordCount>218</wordCount><readingTimeMinutes>2</readingTimeMinutes></post></data></response>
