only start the link checkers when there are links to check

Do not start the ThreadPool when there are no links to check.

Change-Id: I355ea5af5d937e6b5d4cf481d9a29c6d3b123f09
Signed-off-by: Doug Hellmann <doug@doughellmann.com>
This commit is contained in:
Doug Hellmann 2018-01-26 09:53:57 -05:00
parent 7890d18566
commit d9d05a062c

View File

@ -302,23 +302,24 @@ def load_project_data(source_directory,
(url, project['name'], flag, flag_val) (url, project['name'], flag, flag_val)
) )
logger.info('checking %s links from %s...', if links_to_check:
len(links_to_check), filename) logger.info('checking %s links from %s...',
pool = multiprocessing.pool.ThreadPool() len(links_to_check), filename)
results = pool.map(_check_url, links_to_check) pool = multiprocessing.pool.ThreadPool()
results = pool.map(_check_url, links_to_check)
for url, project_name, flag, flag_val, exists, status in results: for url, project_name, flag, flag_val, exists, status in results:
if flag_val and not exists: if flag_val and not exists:
logger.error( logger.error(
'%s set for %s but %s does not exist (%s)', '%s set for %s but %s does not exist (%s)',
flag, project_name, url, status, flag, project_name, url, status,
) )
fail = True fail = True
elif (not flag_val) and check_all_links and exists: elif (not flag_val) and check_all_links and exists:
logger.warning( logger.warning(
'%s not set for %s but %s does exist', '%s not set for %s but %s does exist',
flag, project_name, url, flag, project_name, url,
) )
if fail: if fail:
raise ValueError('invalid input in %s' % filename) raise ValueError('invalid input in %s' % filename)