use join_all instead

This commit is contained in:
OlivierDehaene 2023-04-09 15:10:59 +02:00
parent 4267378b1f
commit af10275f46

View File

@ -60,9 +60,8 @@ impl ShardedClient {
.iter_mut()
.map(|client| Box::pin(client.prefill(batch.clone())))
.collect();
// As soon as we receive one response, we can return as all shards will return the same
let (result, _, _) = select_all(futures).await;
result
// all shards return the same message
join_all(futures).await.pop().unwrap()
}
/// Generate one token for each request in the given cached batches
@ -79,8 +78,7 @@ impl ShardedClient {
.iter_mut()
.map(|client| Box::pin(client.decode(batches.clone())))
.collect();
// As soon as we receive one response, we can return as all shards will return the same
let (result, _, _) = select_all(futures).await;
result
// all shards return the same message
join_all(futures).await.pop().unwrap()
}
}