Make sure thread pool has at least 1 worker.

When doing a 'git cl archive' if there are no branches other then master the
command will crash with a 'ValueError: Number of processes must be at least 1'
when attempting to create the thread pool.

This Cl modifies the code to use the maximum of the changes and 1 as the number
of threads to create so we have at least one thread to work with.

Review-Url: https://codereview.chromium.org/2228723003
changes/90/365990/5
dsinclair 9 years ago committed by Commit bot
parent 13f9c37185
commit 99d3017946

@ -3073,7 +3073,7 @@ def get_cl_statuses(changes, fine_grained, max_processes=None):
pool = ThreadPool(
min(max_processes, len(changes_to_fetch))
if max_processes is not None
else len(changes_to_fetch))
else max(len(changes_to_fetch), 1))
fetched_cls = set()
it = pool.imap_unordered(fetch, changes_to_fetch).__iter__()

Loading…
Cancel
Save