refactor(search_many): drop needless Arc<Mutex>; clarify search()/max_places docs (Closes #40, #42, #39) - #47
Conversation
…_places docs - #40: search_many_on_page runs on a single task with no tokio::spawn sharing out/seen_keys, so replace Arc<Mutex<Vec>>/Arc<Mutex<HashSet>> with plain Vec/HashSet. Removes uncontested async-lock overhead and the never-taken Arc::try_unwrap panic path; return Ok(out) directly. Drops the now-unused Arc and tokio::sync::Mutex imports. - #42: document that MapsScraper::search opens/closes a tab per call and search_many should be preferred for multiple queries. - #39: document that max_places = None is truly unbounded (one navigation per place, no time bound) so callers can bound run time deliberately. The naive early URL-truncation is intentionally avoided: it would drop results because dedup happens after navigation (domain only known once the panel loads). Closes #40, #42, #39 https://claude.ai/code/session_01TPpTHPokxsZ3dQpRzg4NkD
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthrough
ChangesArc/Mutex removal and documentation updates
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related issues
Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
…te to enrich (review fix) From self-review of #47: - search() perf doc now names the fixed ~3s homepage settle delay, the dominant per-call cost that motivates preferring search_many. - max_places doc clarifies the wasted-navigation caveat applies to enrich mode only; non-enrich dedup is pre-navigation so nothing is wasted. https://claude.ai/code/session_01TPpTHPokxsZ3dQpRzg4NkD
|
@coderabbitai review Generated by Claude Code |
|
Tip For best results, initiate chat on the files or code changes. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
echo "=== PR Details ==="
gh pr view 47 --repo Liohtml/google-maps-scraper-rs
echo ""
echo "=== PR Diff ==="
gh pr diff 47 --repo Liohtml/google-maps-scraper-rsLength of output: 9491
Review of PR
|
…-search-cleanup # Conflicts: # CHANGELOG.md
Overview
Three related findings in the search path, all in
src/lib.rs.Arc<Mutex<…>>.search_many_on_pageruns sequentially on one task (notokio::spawnsharesout/seen_keys), so theArc<Mutex<Vec>>/Arc<Mutex<HashSet>>only added uncontested async-lock overhead and a never-takenArc::try_unwrappanic path. Replaced with plainVec/HashSet, returningOk(out)directly; dropped the now-unusedArc/tokio::sync::Muteximports.search()perf doc. Documents that each call opens/closes a Chrome tab + homepage consent, sosearch_manyshould be preferred for multiple queries.max_placesdoc. Documents thatNoneis truly unbounded (one navigation per place, no time bound) so callers can bound run time deliberately.Why #39 is a doc change, not a URL truncation
The issue suggested truncating the collected URL slice to
max_placesbefore the enrich loop. That would regress results: dedup happens after navigation (the website domain is only known once the panel loads), so truncating tomURLs can yield fewer thanmunique places. The existing mid-loop unique-count cap already bounds navigations whenmax_placesis set; the genuine gap was thatNoneis silently unbounded, which is now documented.Test plan
cargo buildcargo test(9 passed)cargo fmt --all -- --checkcargo clippy --all-targets -- -D warningsBehaviour is unchanged (pure refactor + docs); the dedup/
max_places/jitter logic is identical.Closes #40, #42, #39
https://claude.ai/code/session_01TPpTHPokxsZ3dQpRzg4NkD
Generated by Claude Code
Summary by CodeRabbit
Documentation
max_places: Nonereturns unlimited results.Refactor
Chores