Discussion:
createrepo/__init__.py
z***@osuosl.org
2013-10-03 07:47:52 UTC
Permalink
createrepo/__init__.py | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)

New commits:
commit bca63aae1be2fccee57a713a59e6d95cec7162e8
Author: Zdenek Pavlas <***@redhat.com>
Date: Thu Oct 3 09:46:18 2013 +0200

Don't spawn more workers that #pkgfiles.

diff --git a/createrepo/__init__.py b/createrepo/__init__.py
index 1b18a9f..ef63e57 100644
--- a/createrepo/__init__.py
+++ b/createrepo/__init__.py
@@ -108,7 +108,6 @@ class MetaDataConfig(object):
self.read_pkgs_list = None # filepath/name to write out list of pkgs
# read in this run of createrepo
self.collapse_glibc_requires = True
- self.workers = 1 # number of workers to fork off to grab metadata from the pkgs
self.worker_cmd = '/usr/share/createrepo/worker.py'
#self.worker_cmd = './worker.py' # helpful when testing
self.retain_old_md = 0
@@ -618,7 +617,7 @@ class MetaDataGenerator:
# add up the total pkg counts and return that value
self._worker_tmp_path = tempfile.mkdtemp() # setting this in the base object so we can clean it up later
if self.conf.workers < 1:
- self.conf.workers = num_cpus_online()
+ self.conf.workers = min(num_cpus_online(), len(pkgfiles))
pkgfiles.sort()
worker_chunks = split_list_into_equal_chunks(pkgfiles, self.conf.workers)
worker_cmd_dict = {}

Loading...