Repository navigation
refactor: use asyncio.TaskGroup in the error snapshotter - #2321
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## v2 #2321 +/- ##
=====================================
Coverage ? 94.13%
=====================================
Files ? 183
Lines ? 13569
Branches ? 0
=====================================
Hits ? 12773
Misses ? 796
Partials ? 0
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
…nly in the error snapshotter
…d infinite_scroll BREAKING CHANGE: failures from these calls are raised wrapped in an `ExceptionGroup`: - `BasicCrawler.add_requests` and `enqueue_links` / `extract_links` when the `on_skipped_request` callback raises for a robots.txt-disallowed request - `BrowserPool.new_page_with_each_plugin` - `infinite_scroll` (`PlaywrightCrawlingContext.infinite_scroll`)
vdusek
marked this pull request as ready for review
October 14, 2026 13:17
Mantisus
approved these changes
Oct 14, 2026
vdusek
added a commit
that referenced
this pull request
Oct 16, 2026
Converts the error snapshotter's concurrent HTML and screenshot saves to `asyncio.TaskGroup`. Its caller catches and logs any `Exception`, so the `ExceptionGroup` doesn't change behavior. The other places from the issue keep their current code: - `TaskGroup` wraps failures in an `ExceptionGroup`, which defeats the crawler's type-based error handling (retries, error statistics) and users' `except` clauses. That rules out the robots.txt skips, `BrowserPool.new_page_with_each_plugin` and `infinite_scroll`, where the gain is small. - `ThrottlingRequestManager` reads are side-effect-free, so a task group adds code without changing anything. `drop`, `purge` and the sub-manager opening must let every call finish. - `LocalEventManager` runs its readings in `to_thread`, which cancellation can't stop. - The autoscaled pool would start cancelling healthy workers when one fails. - The event manager, RQ background batches, `RecurringTask` and the sitemap loader own tasks that outlive the call that starts them. `_merge_async_generators` is an async generator. Closes: #1722 *✍️ Drafted by Claude Code*
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.
Converts the error snapshotter's concurrent HTML and screenshot saves to
asyncio.TaskGroup. Its caller catches and logs anyException, so theExceptionGroupdoesn't change behavior.The other places from the issue keep their current code:
TaskGroupwraps failures in anExceptionGroup, which defeats the crawler's type-based error handling (retries, error statistics) and users'exceptclauses. That rules out the robots.txt skips,BrowserPool.new_page_with_each_pluginandinfinite_scroll, where the gain is small.ThrottlingRequestManagerreads are side-effect-free, so a task group adds code without changing anything.drop,purgeand the sub-manager opening must let every call finish.LocalEventManagerruns its readings into_thread, which cancellation can't stop.RecurringTaskand the sitemap loader own tasks that outlive the call that starts them._merge_async_generatorsis an async generator.Closes: #1722
✍️ Drafted by Claude Code