Close threadpools after use.

This commit is contained in:
Ralph Bean
2018-08-15 12:47:18 -04:00
parent 2e06199aa8
commit 84762891f7
2 changed files with 9 additions and 3 deletions

View File

@@ -150,8 +150,10 @@ def create_local_repo_from_koji_tag(config, tag, repo_dir, archs=None):
# Download the RPMs four at a time.
pool = ThreadPool(4)
pool.map(_download_file, download_args)
pool.close()
try:
pool.map(_download_file, download_args)
finally:
pool.close()
# If we downloaded something, run the createrepo_c.
if repo_changed:

View File

@@ -134,7 +134,11 @@ def format_mmd(mmd, scmurl, session=None):
# Check that SCM URL is valid and replace potential branches in pkg refs
# by real SCM hash and store the result to our private xmd place in modulemd.
pool = ThreadPool(20)
pkg_dicts = pool.map(_scm_get_latest, mmd.get_rpm_components().values())
try:
pkg_dicts = pool.map(_scm_get_latest, mmd.get_rpm_components().values())
finally:
pool.close()
err_msg = ""
for pkg_dict in pkg_dicts:
if pkg_dict["error"]: