<?xml version="1.0" encoding="UTF-8"?>
<response><data><post><id>155</id><slug>retry-and-backoff-patterns-part-8-155</slug><title>Retry and backoff patterns, part 8</title><excerpt>For part 8, we revisit the basics with a fresh example and a few lessons learned the hard way. Networks fail, servers restart and rate limits kick in. A scraper that gives up at the first error is…</excerpt><seriesName>Retry and backoff patterns</seriesName><seriesPart>8</seriesPart><sections><item><heading>Introduction</heading><paragraphs><item>For part 8, we revisit the basics with a fresh example and a few lessons learned the hard way. 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>Putting it into practice</heading><paragraphs><item>Pagination comes in several shapes: numbered pages, next links, offsets and opaque cursors. Each has trade-offs, and a robust scraper should detect the end of the result set rather than assuming a fixed number of pages.</item><item>Read the site's terms of service before you start. Many sites welcome automated access within limits and say so explicitly; others ask you to use an API instead.</item><item>Time zones matter more than they seem. Store timestamps in UTC and convert only when displaying them.</item></paragraphs></item><item><heading>A practical approach</heading><paragraphs><item>Selectors are the most fragile part of any scraper. Prefer stable attributes such as data-testid or semantic structure over generated class names, which can change on every deploy.</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>12</authorId><authorName>Yuki Andersson</authorName><authorSlug>yuki-andersson</authorSlug><category>Data Engineering</category><tags><item>playwright</item><item>selenium</item><item>javascript</item></tags><publishedAt>2025-05-17T00:00:00.000Z</publishedAt><wordCount>213</wordCount><readingTimeMinutes>2</readingTimeMinutes></post></data></response>
