feat: Add retire_browser_after_page_count parameter for BrowserPool#1266
Merged
Pijukatel merged 3 commits intoapify:masterfrom Jun 26, 2025
Merged
feat: Add retire_browser_after_page_count parameter for BrowserPool#1266Pijukatel merged 3 commits intoapify:masterfrom
retire_browser_after_page_count parameter for BrowserPool#1266Pijukatel merged 3 commits intoapify:masterfrom
Conversation
Collaborator
Author
|
Parameter added following the Crawlee TS. |
Contributor
There was a problem hiding this comment.
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_pagescount - Introduces
retire_browser_after_page_countsetting 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_intervalmistakenly 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_pagesis 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:
Pijukatel
reviewed
Jun 24, 2025
janbuchar
approved these changes
Jun 24, 2025
Collaborator
janbuchar
left a comment
There was a problem hiding this comment.
LGTM, just some minor issues
Pijukatel
approved these changes
Jun 26, 2025
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
retire_browser_after_page_countparameter forBrowserPool