From 164f592c1d96dfbcbcf2b129de092d3e47e8b244 Mon Sep 17 00:00:00 2001 From: mprahl Date: Oct 02 2019 11:37:12 +0000 Subject: Make the DNF minrate setting configurable when loading repos --- diff --git a/module_build_service/config.py b/module_build_service/config.py index 87a6499..e9532d8 100644 --- a/module_build_service/config.py +++ b/module_build_service/config.py @@ -689,6 +689,13 @@ class Config(object): "default": "master", "desc": "Denotes the branch used for rawhide.", }, + "dnf_minrate": { + "type": int, + "default": 1024 * 100, # 100KB + "desc": "The minrate configuration on a DNF repo. This configuration will cause DNF to " + "timeout loading a repo if the download speed is below minrate for the " + "duration of the timeout." + } } def __init__(self, conf_section_obj): diff --git a/module_build_service/scheduler/default_modules.py b/module_build_service/scheduler/default_modules.py index 4313e63..c0d0f9f 100644 --- a/module_build_service/scheduler/default_modules.py +++ b/module_build_service/scheduler/default_modules.py @@ -362,7 +362,9 @@ def _get_rpms_in_external_repo(repo_url, arches, cache_dir_name): canon_arch = koji.canonArch(arch) repo_name = "repo_{}".format(canon_arch) repo_arch_url = repo_url.replace("$arch", canon_arch) - base.repos.add_new_repo(repo_name, dnf_conf, baseurl=[repo_arch_url]) + base.repos.add_new_repo( + repo_name, dnf_conf, baseurl=[repo_arch_url], minrate=conf.dnf_minrate, + ) try: # Load the repos in parallel diff --git a/tests/test_scheduler/test_default_modules.py b/tests/test_scheduler/test_default_modules.py index d2dee05..0b0d4e5 100644 --- a/tests/test_scheduler/test_default_modules.py +++ b/tests/test_scheduler/test_default_modules.py @@ -419,8 +419,11 @@ def test_get_rpms_in_external_repo(mock_makedirs, mock_dnf_base): # Test that i686 is mapped to i386 using the koji.canonArch(). mock_dnf_base.return_value.repos.add_new_repo.assert_called_with( - 'repo_i386', mock_dnf_base.return_value.conf, - baseurl=['http://domain.local/repo/latest/i386/']) + "repo_i386", + mock_dnf_base.return_value.conf, + baseurl=["http://domain.local/repo/latest/i386/"], + minrate=conf.dnf_minrate, + ) def test_get_rpms_in_external_repo_invalid_repo_url():