nix: Another deployment parallelization oops

This commit is contained in:
Zhaofeng Li 2021-12-03 00:06:17 -08:00
parent 2bba64a002
commit a3e292d7fb

View file

@ -329,17 +329,16 @@ impl Deployment {
let nodes = vec![target.name.clone()];
let permit = self.parallelism_limit.apply.acquire().await.unwrap();
let push_job = parent.create_job(JobType::Push, nodes.clone())?;
let push_profile = profile.clone();
let arc_self = self.clone();
let mut target = push_job.run_waiting(|job| async move {
let mut target = push_job.run(|job| async move {
if target.host.is_none() {
return Err(NixError::Unsupported);
}
let permit = arc_self.parallelism_limit.apply.acquire().await.unwrap();
job.state(JobState::Running)?;
let host = target.host.as_mut().unwrap();
host.set_job(Some(job.clone()));
host.copy_closure(
@ -347,7 +346,6 @@ impl Deployment {
CopyDirection::ToRemote,
arc_self.options.to_copy_options()).await?;
drop(permit);
Ok(target)
}).await?;
@ -441,6 +439,8 @@ impl Deployment {
}).await?;
}
drop(permit);
Ok(())
}
}