Skip to content

fix: Defer page object cleanup to make it accessible in error handlers#1814

Merged
janbuchar merged 2 commits intomasterfrom
deferred-page-object-cleanup
Mar 30, 2026
Merged

fix: Defer page object cleanup to make it accessible in error handlers#1814
janbuchar merged 2 commits intomasterfrom
deferred-page-object-cleanup

Conversation

@janbuchar
Copy link
Copy Markdown
Collaborator

@janbuchar janbuchar added the t-tooling Issues with this label are in the ownership of the tooling team. label Mar 27, 2026
@janbuchar janbuchar requested review from Pijukatel and vdusek March 27, 2026 14:42
@github-actions github-actions bot added this to the 137th sprint - Tooling team milestone Mar 27, 2026
@github-actions github-actions bot added the tested Temporary label used only programatically for some analytics. label Mar 27, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Mar 27, 2026

Codecov Report

❌ Patch coverage is 87.50000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 92.28%. Comparing base (6f2ac13) to head (d76da4d).
⚠️ Report is 25 commits behind head on master.

Files with missing lines Patch % Lines
src/crawlee/crawlers/_basic/_basic_crawler.py 66.66% 2 Missing ⚠️
...rawlee/crawlers/_playwright/_playwright_crawler.py 90.90% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1814      +/-   ##
==========================================
+ Coverage   92.25%   92.28%   +0.02%     
==========================================
  Files         157      157              
  Lines       10847    10886      +39     
==========================================
+ Hits        10007    10046      +39     
  Misses        840      840              
Flag Coverage Δ
unit 92.28% <87.50%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Collaborator

@vdusek vdusek left a comment

Choose a reason for hiding this comment

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

Just a few comments/questions, otherwise LGTM

Copy link
Copy Markdown
Collaborator

@Pijukatel Pijukatel left a comment

Choose a reason for hiding this comment

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

Nice. Please also remove a portion of the ErrorTracker-related code that becomes redundant with this change.

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.

As far as I understand this change. This should now be redundant,

So all this can be deleted and also the whole early argument and all its usage (_early_reported_errors) . ErrorTracker is private, so such a change is fine.

        # Collect data in case of errors, before the page object is closed.
        if error:
            await self.statistics.error_tracker.add(error=error, context=context, early=True)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

Thanks, implemented!

@janbuchar janbuchar merged commit 7eeb500 into master Mar 30, 2026
32 checks passed
@janbuchar janbuchar deleted the deferred-page-object-cleanup branch March 30, 2026 09:15
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. tested Temporary label used only programatically for some analytics.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PlaywrightCrawler error_handler cannot access Page object

4 participants