Skip to content

fix(crawlers)!: Leave retrying request manager calls to the backends - #2578

Draft
Mantisus wants to merge 2 commits into
apify:v2from
Mantisus:fix-timeouts-handling
Draft

Mantisus wants to merge 2 commits into
apify:v2from
Mantisus:fix-timeouts-handling

Conversation

@Mantisus

@Mantisus Mantisus commented Dec 3, 2026

Copy link
Copy Markdown
Collaborator

Description

The crawler now makes one attempt at each call to its request manager and session pool, such as fetching the next request, marking it as handled, giving it back or taking a session. Each call, giving back a request deferred by a RequestThrottledError included, gets internal_timeout to finish. The SQL and Redis backends retry transient errors themselves, and a custom request manager or session pool should do the same.

When the handling of a failed request times out, such as in a slow error_handler, the crawler now retries the request if it can still be retried, counts the retry, and retires the session of a SessionError. A timed-out failed_request_handler logs a warning and the crawl goes on. Any other timeout still ends the crawl. The crawler also counts a failed request in its statistics before the failed_request_handler runs, so a handler that raises no longer leaves it uncounted.

Issues

Testing

  • New unit tests for the crawler and wait_for.

✍️ Drafted by Claude Code

@Mantisus
Mantisus marked this pull request as draft December 3, 2026 14:59
@Mantisus Mantisus self-assigned this Dec 3, 2026
@github-actions github-actions Bot added the t-tooling Issues with this label are in the ownership of the tooling team. label Dec 3, 2026
@Mantisus
Mantisus force-pushed the fix-timeouts-handling branch from 4c9bb81 to 51f63d3 Compare December 3, 2026 23:36

This branch has not been deployed

No deployments
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.

1 participant