improve uc

pull/289/head
vapao 2021-03-17 19:39:50 +08:00
parent 93a8340bd2
commit 27868ac32e
2 changed files with 3 additions and 2 deletions

View File

@ -62,7 +62,8 @@ def _ext1_deploy(req, helper, env):
extend = req.deploy.extend_obj
env.update(SPUG_DST_DIR=extend.dst_dir)
threads, latest_exception = [], None
with futures.ThreadPoolExecutor(max_workers=min(10, os.cpu_count() + 5)) as executor:
max_workers = min(10, os.cpu_count() * 4) if req.deploy.is_parallel else 1
with futures.ThreadPoolExecutor(max_workers=max_workers) as executor:
for h_id in json.loads(req.host_ids):
env = AttrDict(env.items())
t = executor.submit(_deploy_ext1_host, req, helper, h_id, env)

View File

@ -247,7 +247,7 @@ def post_request_1(request):
form.version = repository.version
form.spug_version = repository.spug_version
form.deploy_id = repository.deploy_id
form.host_ids = json.dumps(form.host_ids)
form.host_ids = json.dumps(sorted(form.host_ids))
if form.id:
req = DeployRequest.objects.get(pk=form.id)
is_required_notify = repository.deploy.is_audit and req.status == '-1'