-
Notifications
You must be signed in to change notification settings - Fork 477
feat: Add retire_browser_after_page_count
parameter for BrowserPool
#1266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Parameter added following the Crawlee TS. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds a new retire_browser_after_page_count
option to retire browsers after they’ve opened a certain number of pages.
- Tracks and exposes a per-browser
total_pages
count - Introduces
retire_browser_after_page_count
setting and retirement logic inBrowserPool
- Adds a unit test for the new retirement behavior
Reviewed Changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
File | Description |
---|---|
tests/unit/browsers/test_browser_pool.py | New parametrized test for retirement behavior |
src/crawlee/browsers/_playwright_browser_controller.py | Add total_pages state, property, and increment |
src/crawlee/browsers/_browser_pool.py | Add constructor parameter, doc updates, and retire logic |
src/crawlee/browsers/_browser_controller.py | Declare abstract total_pages property in interface |
Comments suppressed due to low confidence (2)
src/crawlee/browsers/_browser_pool.py:68
- The docstring for
identify_inactive_browsers_interval
mistakenly says 'retired'; it should read 'inactive' to accurately reflect that this interval only flags browsers as inactive.
as retired.
src/crawlee/browsers/_browser_controller.py:31
- Since
total_pages
is now abstract onBrowserController
, ensure every concrete implementation (not just Playwright) overrides this property to prevent instantiation errors or missing behavior.
def total_pages(self) -> int:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just some minor issues
Description
retire_browser_after_page_count
parameter forBrowserPool