From 99d3017946e02465e04c557e0c1b1201ada85a58 Mon Sep 17 00:00:00 2001 From: dsinclair Date: Tue, 9 Aug 2016 10:48:58 -0700 Subject: [PATCH] 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 --- git_cl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git_cl.py b/git_cl.py index 014c3dc82..a8eb59f5b 100755 --- a/git_cl.py +++ b/git_cl.py @@ -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__()