Repository navigation
feat(crawlers)!: Add per-route timeouts and extend_timeout() - #2429
Merged
Merged
Conversation
Mantisus
marked this pull request as draft
November 9, 2026 22:17
Mantisus
force-pushed
the
timeouts-routes
branch
from
November 12, 2026 13:03
17b1942 to
76d68a8
Compare
Mantisus
marked this pull request as ready for review
November 12, 2026 13:46
context.extend_timeout()extend_timeout()
vdusek
reviewed
Nov 16, 2026
Collaborator
|
Hi @Mantisus, maybe you forgot to push? 🙂 (there are no new commits) |
Collaborator
Author
Yes, sorry...🤦 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Router.handler()andRouter.default_handler()take arequest_handler_timeoutthat replaces the crawler's timeout for the requests the handler handles.context.extend_timeout()gives the running part of the request processing more time, as in Crawlee JS. Called from a navigation hook, it extends the navigation timeout. Called from the request handler or an error handler, it extends the timeout of that handler. It also extends the lock of the request in the request manager.The crawler tells the request manager how long it holds a request, based on its longest request handler timeout, including the router handlers, so
SqlStorageBackendandRedisStorageBackendkeep the request locked long enough. HTTP crawlers bound the navigation request and reading its body withnavigation_timeoutthemselves, so an extension reaches the body. WithFileDownloadCrawler(stream=True), the body streamed in the request handler counts towardsrequest_handler_timeout. The upgrade guide covers the changes.Issues
timeout=Nonedisable the timeout #2428✍️ Drafted by Claude Code