Created
August 2, 2024 00:31
-
-
Save mijdavis2/b37821a362df919cf8f3e2817fb86ce7 to your computer and use it in GitHub Desktop.
Python's new threadpool example
This file contains 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
# Without threadpool | |
for repo in repos: | |
update_repo_data(repo) | |
# ----------------------------------------------------------------------------------- # | |
# With threadpool | |
with concurrent.futures.ThreadPoolExecutor(max_workers=MAX_EXECUTORS) as executor: | |
executor.map(update_repo_data, repos) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment