{"data":{"id":155,"slug":"retry-and-backoff-patterns-part-8-155","title":"Retry and backoff patterns, part 8","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…","seriesName":"Retry and backoff patterns","seriesPart":8,"sections":[{"heading":"Introduction","paragraphs":["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."]},{"heading":"Putting it into practice","paragraphs":["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.","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.","Time zones matter more than they seem. Store timestamps in UTC and convert only when displaying them."]},{"heading":"A practical approach","paragraphs":["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.","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."]},{"heading":"Key takeaway","paragraphs":["Retry only on errors that can succeed later (timeouts, 429, 5xx), use exponential backoff with jitter, and cap the number of attempts."]}],"authorId":12,"authorName":"Yuki Andersson","authorSlug":"yuki-andersson","category":"Data Engineering","tags":["playwright","selenium","javascript"],"publishedAt":"2025-05-17T00:00:00.000Z","wordCount":213,"readingTimeMinutes":2}}