File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change 11[run]
2- source = apt_mirror_updater
2+ branch = true
3+ concurrency = multiprocessing
34omit = apt_mirror_updater/tests.py
5+ parallel = True
6+ source = apt_mirror_updater
Original file line number Diff line number Diff line change 11# Automated, robust apt-get mirror selection for Debian and Ubuntu.
22#
33# Author: Peter Odding <peter@peterodding.com>
4- # Last Change: October 31, 2017
4+ # Last Change: April 15, 2020
55# URL: https://apt-mirror-updater.readthedocs.io
66
77"""Simple, robust and concurrent HTTP requests (designed for one very narrow use case)."""
@@ -81,9 +81,14 @@ def fetch_concurrent(urls, concurrency=None):
8181 concurrency = get_default_concurrency ()
8282 pool = multiprocessing .Pool (concurrency )
8383 try :
84- return pool .map (fetch_worker , urls , chunksize = 1 )
85- finally :
84+ results = pool .map (fetch_worker , urls , chunksize = 1 )
85+ pool .close ()
86+ pool .join ()
87+ return results
88+ except Exception :
8689 pool .terminate ()
90+ pool .join ()
91+ raise
8792
8893
8994def get_default_concurrency ():
You can’t perform that action at this time.
0 commit comments