-
Couldn't load subscription status.
- Fork 1.4k
Add internal Promise#succeedUnit method to avoid Exit allocation when possible
#9571
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…when possible Idea comes from @hearnadam's review in this PR: #9556
| shutdownFlag.set(true) | ||
| ZIO | ||
| .whenZIO(shutdownHook.succeed(())) { | ||
| .whenZIO(shutdownHook.succeedUnit) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bit outside the scope of this PR, but since we're at it, you can use whenZIODiscard to avoid the Some allocation and the FlatMap below from calling unit
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. I also used ZIO.foreachParDiscard
| shutdownFlag.set(true) | ||
| ZIO | ||
| .whenZIO(shutdownHook.succeed(())) { | ||
| .whenZIO(shutdownHook.succeedUnit) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
Idea comes from @hearnadam's review in this PR: #9556