summaryrefslogtreecommitdiffstats
path: root/progress.py
diff options
context:
space:
mode:
authorMike Frysinger <vapier@google.com>2021-02-24 00:15:32 -0500
committerMike Frysinger <vapier@google.com>2021-04-01 14:52:57 +0000
commitb2fa30a2b891b22c173c960a67bf38ccbba8de1b (patch)
treeae532bceade00e3509c8fb59026c056e0f49b7c9 /progress.py
parentd246d1fee7f42f2526a20a96597c8f01eda31433 (diff)
downloadgit-repo-b2fa30a2b891b22c173c960a67bf38ccbba8de1b.tar.gz
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>
Diffstat (limited to 'progress.py')
-rw-r--r--progress.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/progress.py b/progress.py
index ae797488..de46f538 100644
--- a/progress.py
+++ b/progress.py
@@ -42,12 +42,12 @@ def duration_str(total):
42 42
43 43
44class Progress(object): 44class Progress(object):
45 def __init__(self, title, total=0, units='', print_newline=False): 45 def __init__(self, title, total=0, units='', print_newline=False, delay=True):
46 self._title = title 46 self._title = title
47 self._total = total 47 self._total = total
48 self._done = 0 48 self._done = 0
49 self._start = time() 49 self._start = time()
50 self._show = False 50 self._show = not delay
51 self._units = units 51 self._units = units
52 self._print_newline = print_newline 52 self._print_newline = print_newline
53 # Only show the active jobs section if we run more than one in parallel. 53 # Only show the active jobs section if we run more than one in parallel.