From 0ec4f3b95c00517c77d51006d41b555a438a11f3 Mon Sep 17 00:00:00 2001 From: Alex Koshelev Date: Wed, 8 Nov 2023 17:10:41 -0800 Subject: [PATCH] Temporarily revert parallel_join to 1 thread --- src/seq_join.rs | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/src/seq_join.rs b/src/seq_join.rs index 17f214a84..d15cf2cc4 100644 --- a/src/seq_join.rs +++ b/src/seq_join.rs @@ -137,30 +137,31 @@ pub trait SeqJoin { } /// Join multiple tasks in parallel. Only do this if you can't use a sequential join. - fn parallel_join(&self, iterable: I) -> Pin, E>> + Send>> + fn parallel_join(&self, iterable: I) -> TryJoinAll where I: IntoIterator + Send, F: Future> + Send, O: Send + 'static, E: Send + 'static { + // let iterable = iterable.into_iter().map(|f| { // spawner.spawn(f) // }); // let spawner = UnsafeSpawner::default(); - let mut futures = FuturesOrdered::default(); - let spawner = UnsafeSpawner::default(); - for f in iterable.into_iter() { - futures.push_back(spawner.spawn(f)); - } - - Box::pin(async move { futures.try_collect().await }) + // let mut futures = FuturesOrdered::default(); + // let spawner = UnsafeSpawner::default(); + // for f in iterable.into_iter() { + // futures.push_back(spawner.spawn(f)); + // } + // + // Box::pin(async move { futures.try_collect().await }) // ParallelFutures2 { // spawner, // inner: futures::future::try_join_all(iterable.into_iter().map(|f| spawner.spawn(f))), // } // #[allow(clippy::disallowed_methods)] // Just in this one place. - // futures::future::try_join_all(iterable.into_iter() + futures::future::try_join_all(iterable) // .map(|f| tokio::spawn())) }