feat(main): use thread pool for concurrent scraping #83
+12
−4
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.
This pull request introduces concurrent scraping to the spider_some_note function in main.py using a ThreadPoolExecutor, significantly improving the performance of scraping multiple notes—especially when retrieving all notes from a user.
Problem
The previous implementation of spider_some_note scraped notes sequentially, which was:
Slow for users with many notes
Inefficient, as it did not leverage available system resources
Solution
Refactored the spider_some_note function to use Python’s ThreadPoolExecutor, enabling:
Concurrent scraping of notes
Parallel execution, reducing overall scraping time
Benefits
Improved Performance: Dramatically faster scraping of multiple notes
Increased Efficiency: Maximizes use of system resources by running scraping tasks in parallel