Skip to content
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

optimize link extraction: (fixes #376) #380

Merged
merged 3 commits into from
Sep 15, 2023
Merged

optimize link extraction: (fixes #376) #380

merged 3 commits into from
Sep 15, 2023

Conversation

ikreymer
Copy link
Member

  • dedup URLs in browser first
  • don't return entire list of URLs, process one-at-a-time via registered callback function
  • add exposeFunction per page in setupPage, then register 'addLink' callback for each pages' handler
  • optimize addqueue: atomically check if already at max urls and if url already seen in one redis call, as links can be added async
  • better logging: log rejected promises for link extraction
  • browser: set protocolTimeout to 0 to avoid CDP timeout errors

util/worker.js Show resolved Hide resolved
util/state.js Outdated Show resolved Hide resolved
- dedup urls in browser first
- don't return entire list of URLs, process one-at-a-time via callback
- add exposeFunction per page in setupPage, then register 'addLink' callback for each pages' handler
- optimize addqueue: atomically check if already at max urls and if url already seen in one redis call
- better logging: log rejected promises for link extraction
- change error state to differntiate limit hit vs dupe url
- add QueueState enum to indicate success, limit hit, or dupe url
crawler.js Outdated Show resolved Hide resolved
@ikreymer
Copy link
Member Author

Also added additional test which ensures exact page limit is reached, would've caught the early limit issue.

@ikreymer ikreymer merged commit e5b0c4e into main Sep 15, 2023
2 checks passed
@ikreymer ikreymer deleted the opt-link-extraction branch September 15, 2023 17:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants