Commit 99d30179 authored by dsinclair's avatar dsinclair Committed by Commit bot

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
parent 13f9c371
......@@ -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__()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment