diff --git a/module_build_service/builder/utils.py b/module_build_service/builder/utils.py index aa616f69..42a6cfca 100644 --- a/module_build_service/builder/utils.py +++ b/module_build_service/builder/utils.py @@ -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: diff --git a/module_build_service/utils/submit.py b/module_build_service/utils/submit.py index ff9febda..71a19ee7 100644 --- a/module_build_service/utils/submit.py +++ b/module_build_service/utils/submit.py @@ -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"]: