nix: Fix deployment parallelization

This commit is contained in:
Zhaofeng Li 2021-12-02 23:49:35 -08:00
parent 5b2d8d75e7
commit 2bba64a002
4 changed files with 48 additions and 1 deletions

View file

@ -226,11 +226,16 @@ impl Deployment {
return Ok(());
}
let mut futures = Vec::new();
for (name, profile) in profiles.iter() {
let target = chunk.remove(name).unwrap();
self.clone().deploy_node(parent.clone(), target, profile.clone()).await?;
futures.push(self.clone().deploy_node(parent.clone(), target, profile.clone()));
}
let result: NixResult<Vec<()>> = join_all(futures).await.into_iter().collect();
result?;
// Create GC root
if self.options.create_gc_roots {
let job = parent.create_job(JobType::CreateGcRoots, nodes.clone())?;