No submaterializing inner source when outer stream already canceled (#23723)
* Do not try to submaterialize inner source when outer stream already cancelled #23656 * Use StreamDetachedException * Sleep a little * Updated exception text
This commit is contained in:
parent
edcc2b2d75
commit
6db974b6f4
5 changed files with 29 additions and 20 deletions
|
|
@ -276,13 +276,16 @@ object Source {
|
|||
|
||||
/**
|
||||
* Streams the elements of the given future source once it successfully completes.
|
||||
* If the future fails the stream is failed.
|
||||
* If the [[Future]] fails the stream is failed with the exception from the future. If downstream cancels before the
|
||||
* stream completes the materialized `Future` will be failed with a [[StreamDetachedException]]
|
||||
*/
|
||||
def fromFutureSource[T, M](future: Future[Graph[SourceShape[T], M]]): Source[T, Future[M]] = fromGraph(new FutureFlattenSource(future))
|
||||
|
||||
/**
|
||||
* Streams the elements of an asynchronous source once its given `completion` stage completes.
|
||||
* If the `completion` fails the stream is failed with that exception.
|
||||
* If the [[CompletionStage]] fails the stream is failed with the exception from the future.
|
||||
* If downstream cancels before the stream completes the materialized `Future` will be failed
|
||||
* with a [[StreamDetachedException]]
|
||||
*/
|
||||
def fromSourceCompletionStage[T, M](completion: CompletionStage[_ <: Graph[SourceShape[T], M]]): Source[T, CompletionStage[M]] = fromFutureSource(completion.toScala).mapMaterializedValue(_.toJava)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue