Skip to content

fix(throttling-manager): Stop holding a concurrency slot while a domain is throttled - #2176

Open
Mantisus wants to merge 4 commits into
apify:masterfrom
Mantisus:throttling-fetch-request
Open

fix(throttling-manager): Stop holding a concurrency slot while a domain is throttled#2176
Mantisus wants to merge 4 commits into
apify:masterfrom
Mantisus:throttling-fetch-request

Conversation

@Mantisus

Copy link
Copy Markdown
Collaborator

Description

  • fetch_next_request now returns None instead of sleeping out a cooldown, and is_empty() counts only domains that are not throttled, so the autoscaled pool idles instead of holding worker slots. is_finished() still counts every domain, so the crawl does not end while throttled requests are queued. The old sleep occupied a slot while the system read as idle, which pushed desired_concurrency up during the cooldown and burst the moment it expired.

Issues

Testing

  • Update unit tests

@Mantisus Mantisus self-assigned this Aug 19, 2026
@vdusek
vdusek requested review from apify-factory and a balanced review from Copilot August 20, 2026 07:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Updates throttling behavior so cooldowns no longer occupy crawler concurrency slots.

Changes:

  • Return immediately when only throttled requests remain.
  • Treat throttled queues as temporarily empty while keeping the crawl unfinished.
  • Add tests for cooldown, crawl-delay, expiry, and scheduling order.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/crawlee/request_loaders/_throttling_request_manager.py Skips throttled domains without waiting and updates readiness semantics.
tests/unit/test_throttling_request_manager.py Verifies non-blocking throttling and domain scheduling behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@vdusek vdusek left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

@vdusek
vdusek requested a review from Pijukatel August 20, 2026 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ThrottlingRequestManager.fetch_next_request holds a concurrency slot while waiting out a throttle

4 participants