fix(config): make body visibility timeout configurable - #2131
fix(config): make body visibility timeout configurable#2131nightcityblade wants to merge 2 commits into
Conversation
|
@nightcityblade Thanks — approach looks right. Default stays 30000 so nobody's existing crawls change, and I checked the plumbing: Three things before merge:
Separate from this PR: even after it lands, the default path still spends 30 silent seconds on these pages. |
|
Thanks for the detailed review. Addressed in
Focused validation passes: 40 config tests and 38 trust-boundary tests. I kept the separate timeout-debug logging idea out of this PR as suggested. |
Summary
Fixes #2129.
Add
CrawlerRunConfig.body_visibility_timeout, defaulting to the existing 30-second behavior, and use it for the body visibility check. This lets callers lower the ceiling for pages whose body remains hidden without changing the default crawl behavior. The value is included in config serialization and the untrusted-config allowlist, validated as a positive number, and capped at 60 seconds for untrusted Docker input.List of files changed and why
crawl4ai/async_configs.py- define, document, serialize, validate, allow, and cap the new configuration field.crawl4ai/async_crawler_strategy.py- pass the configured timeout to the body visibility wait.docs/md_v2/api/parameters.mdanddocs/md_v2/complete-sdk-reference.md- document the new public option.tests/test_config_defaults.py- cover the default and round trip, invalid values, the untrusted cap, and propagation intocsp_compliant_wait.How Has This Been Tested?
/tmp/crawl4ai-followup-venv/bin/python -m pytest tests/test_config_defaults.py -q— 40 passed, 1 existing warning./tmp/crawl4ai-followup-venv/bin/python -m pytest deploy/docker/tests/test_security_trust_boundary.py -q— 38 passed, 4 existing warnings./tmp/crawl4ai-followup-venv/bin/ruff check --isolated --select E9,F63,F7,F82 --ignore F821 crawl4ai/async_configs.py crawl4ai/async_crawler_strategy.py tests/test_config_defaults.py— passed. (F821is excluded because of the existingVirtualScrollConfigforward-reference finding inasync_crawler_strategy.py.)/tmp/crawl4ai-followup-venv/bin/python -m compileall -q crawl4ai/async_configs.py crawl4ai/async_crawler_strategy.py tests/test_config_defaults.py— passed.git diff --check— passed.Checklist: