Skip to content

Instantly share code, notes, and snippets.

@mijdavis2
Created August 2, 2024 00:31
Show Gist options
  • Save mijdavis2/b37821a362df919cf8f3e2817fb86ce7 to your computer and use it in GitHub Desktop.
Save mijdavis2/b37821a362df919cf8f3e2817fb86ce7 to your computer and use it in GitHub Desktop.
Python's new threadpool example
# 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