Skip to content

fix(throttling-manager): Use the longest robots.txt crawl-delay - #2520

Merged
vdusek merged 2 commits into
apify:v2from
Mantisus:throttler-longest-crawl-delay
Nov 28, 2026
Merged

vdusek merged 2 commits into
apify:v2from
Mantisus:throttler-longest-crawl-delay

Conversation

@Mantisus

@Mantisus Mantisus commented Nov 25, 2026 •

Copy link
Copy Markdown
Collaborator

Description

When one domain gets crawl-delays from several robots.txt files, ThrottlingRequestManager now keeps the longest one instead of the first. Several files cover one domain for a site and its subdomains under throttle_by='registrable_domain', and for HTTP and HTTPS of one host. A robots.txt re-fetch still can't speed a domain up, it can only slow it down.

The same change for Crawlee JS is tracked in apify/crawlee#4491, with a fix proposed in apify/crawlee#4493.

Issues

✍️ Drafted by Claude Code

@Mantisus Mantisus self-assigned this Nov 25, 2026
@github-actions github-actions Bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Nov 25, 2026
@Mantisus
Mantisus requested a review from vdusek November 25, 2026 22:42
@Mantisus
Mantisus marked this pull request as draft November 25, 2026 22:42
@Mantisus
Mantisus force-pushed the throttler-longest-crawl-delay branch from b6a7a9e to f441400 Compare November 27, 2026 13:51
@Mantisus
Mantisus marked this pull request as ready for review November 27, 2026 13:52
@vdusek vdusek changed the title fix(throttling-manager): Pace a domain by its longest robots.txt crawl-delay fix(throttling-manager): Use the longest robots.txt crawl-delay Nov 27, 2026
Comment thread docs/06_upgrading/upgrading_to_v2.md Resolved
@Mantisus
Mantisus requested a review from vdusek November 27, 2026 21:32
@vdusek
vdusek merged commit 4a4fd8f into apify:v2 Nov 28, 2026
42 checks passed
vdusek pushed a commit that referenced this pull request Nov 29, 2026
### Description

When one domain gets crawl-delays from several robots.txt files,
`ThrottlingRequestManager` now keeps the longest one instead of the
first. Several files cover one domain for a site and its subdomains
under `throttle_by='registrable_domain'`, and for HTTP and HTTPS of one
host. A robots.txt re-fetch still can't speed a domain up, it can only
slow it down.

The same change for Crawlee JS is tracked in apify/crawlee#4491, with a
fix proposed in apify/crawlee#4493.

### Issues

- Follow-up: #2507

*✍️ Drafted by Claude Code*
vdusek pushed a commit that referenced this pull request Dec 1, 2026
…breaking the crawl (#2553)

### Description

The crawler caps a robots.txt `Crawl-delay` at one day before passing it
to the request manager and logs a warning once per domain when it does.
A larger value made the crawl fail with `OverflowError`, either while
the crawler checked robots.txt or when the throttler armed the delay at
dispatch. A `Retry-After` header longer than one day is capped at one
day too. A larger number raised `OverflowError` while the crawler read
it, so the 429 failed the request as an ordinary error instead of
backing off.

### Issues

- Follow-up: #2520

*✍️ Drafted by Claude Code*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-tooling Issues with this label are in the ownership of the tooling team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants