sync: switch network fetch to multiprocessing

This avoids GIL limitations with using threads for parallel processing.

This reworks the fetch logic to return results for processing in the
main thread instead of leaving every thread to do its own processing.

We have to tweak the chunking logic a little here because multiprocessing
favors batching over returning immediate results when using a larger value
for chunksize.  When a single job can be quite slow, this tradeoff is not
good UX.

Bug: https://crbug.com/gerrit/12389
Change-Id: I0f0512d15ad7332d1eb28aff52c29d378acc9e1d
Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/298642
Reviewed-by: Chris Mcdonald <cjmcdonald@google.com>
Tested-by: Mike Frysinger <vapier@google.com>
This commit is contained in:
Mike Frysinger
2021-02-24 00:15:32 -05:00
parent d246d1fee7
commit b2fa30a2b8
2 changed files with 90 additions and 123 deletions

View File

@ -42,12 +42,12 @@ def duration_str(total):
class Progress(object):
def __init__(self, title, total=0, units='', print_newline=False):
def __init__(self, title, total=0, units='', print_newline=False, delay=True):
self._title = title
self._total = total
self._done = 0
self._start = time()
self._show = False
self._show = not delay
self._units = units
self._print_newline = print_newline
# Only show the active jobs section if we run more than one in parallel.