=str - 16503 - Implements a dedicated FutureSource

Avoids the overhead of
`Source.single(future).mapAsyncUnordered(1)(identity).withAttr…`

Fixes #16503
This commit is contained in:
Viktor Klang 2016-01-06 13:01:37 +01:00
parent 1ac9b4eafb
commit 59bff70c87
2 changed files with 24 additions and 1 deletions

View file

@ -215,7 +215,7 @@ object Source {
* The stream terminates with a failure if the `Future` is completed with a failure.
*/
def fromFuture[T](future: Future[T]): Source[T, Unit] =
single(future).mapAsyncUnordered(1)(ConstantFun.scalaIdentityFunction).withAttributes(DefaultAttributes.futureSource)
fromGraph(new FutureSource(future))
/**
* Elements are emitted periodically with the specified interval.