This commit is contained in:
Antonio Scandurra
2021-07-09 18:32:57 +02:00
parent 0e19b061d4
commit 13c56cf6ce
2 changed files with 31 additions and 33 deletions
+7 -16
View File
@@ -204,22 +204,13 @@ impl Background {
_phantom: PhantomData,
};
(scheduler)(&mut scope);
match self {
Self::Deterministic(_) => {
for spawned in scope.futures {
spawned.await;
}
}
Self::Production { executor, .. } => {
let spawned = scope
.futures
.into_iter()
.map(|f| executor.spawn(f))
.collect::<Vec<_>>();
for task in spawned {
task.await;
}
}
let spawned = scope
.futures
.into_iter()
.map(|f| self.spawn(f))
.collect::<Vec<_>>();
for task in spawned {
task.await;
}
}
}