Implement batchAndParallelExecute with Future.traverse rather than Future.sequence (#5051)

This commit is contained in:
Chris Stewart 2023-04-20 17:59:09 -05:00 committed by GitHub
parent 5f9c89820f
commit 3740b4fc35
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -122,9 +122,8 @@ object FutureUtil {
Future.successful(Vector.empty)
} else {
val batches = elements.grouped(batchSize).toVector
val execute: Vector[Future[U]] = batches.map(b => f(b))
val doneF = Future.sequence(execute)
doneF
val executeF: Future[Vector[U]] = Future.traverse(batches)(f(_))
executeF
}
}