Reduce workers for label lookups

Using 16 causes excessive auth requests and gets us rate limited
upstream. Let's make this dynamic so that the upstream VMs will use less
workers.

Partial-Bug: #1889122
Change-Id: Ib6fed59337f3dac07264052aaf2973ec5a69504f
(cherry picked from commit 5602dfd986)
This commit is contained in:
Alex Schultz 2020-08-05 08:27:53 -06:00
parent aa4825cb53
commit 84fc9430e2
1 changed files with 2 additions and 1 deletions

View File

@ -888,7 +888,8 @@ class BaseImageUploader(object):
tags_get_args.append((self, image, session))
images = []
with futures.ThreadPoolExecutor(max_workers=16) as p:
workers = min(max(2, processutils.get_worker_count() // 2), 8)
with futures.ThreadPoolExecutor(max_workers=workers) as p:
for image, tags in p.map(tags_for_image, tags_get_args):
if not tags:
continue