Simplify lazySingle and lazyFuture via operator composition#2731
Draft
pjfanning wants to merge 3 commits intoapache:mainfrom
Draft
Simplify lazySingle and lazyFuture via operator composition#2731pjfanning wants to merge 3 commits intoapache:mainfrom
pjfanning wants to merge 3 commits intoapache:mainfrom
Conversation
…m graph stages Co-authored-by: pjfanning <11783444+pjfanning@users.noreply.github.com>
… attribute names Co-authored-by: pjfanning <11783444+pjfanning@users.noreply.github.com>
Member
Author
|
I'll leave this as Draft to allow discussion about whether the customised code that this PR removes is actually better than this change. |
Member
Author
|
@He-Pin wdyt? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port of akka/akka-core#31735. Replaces custom
LazySingleSourceandLazyFutureSourcegraph stages with equivalent compositions of existing operators, removing ~120 lines of bespoke stage code.part of #2730
Changes
scaladsl/Source.scalalazySingle:fromGraph(new LazySingleSource(create))→single(()).map(_ => create()).withAttributes(DefaultAttributes.lazySingle)lazyFuture:fromGraph(new LazyFutureSource(create))→single(()).mapAsyncUnordered(1)(_ => create()).withAttributes(DefaultAttributes.lazyFuture)impl/Stages.scala: AddedDefaultAttributes.lazySingleandDefaultAttributes.lazyFuture; removed now-unusedlazySingleSourceandlazyFutureSourceimpl/fusing/LazySingleSource.scala,impl/fusing/LazyFutureSource.scalamapAsyncUnordered(1)is used directly forlazyFuturesincemapAsync(1)is internally optimised to unordered anyway.