-
Couldn't load subscription status.
- Fork 1.4k
Replace all internal ZIO.fail(None) with Exit.failNone
#9359
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
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.
I know the PR is still in draft but love it already! Just some minor comments most which we might want to address in followup PRs
| for { | ||
| bytesRead <- ZIO.attempt(channel.read(reusableBuffer)).asSomeError | ||
| _ <- ZIO.fail(None).when(bytesRead == -1) | ||
| _ <- Exit.failNone.when(bytesRead == -1) |
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.
A bit outside of the scope of this PR, but since we're at it might change these usages to whenDiscard
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
| pull.mapError(error => Some(error)).flatMap { | ||
| case Left(done) => ZIO.fail(None) | ||
| case Right(elem) => ZIO.succeed(elem) | ||
| case Left(done) => Exit.failNone |
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.
Let's use foldZIO instead of mapError and flatMap in the line above this while we're at it
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
| bytesRead <- ZIO.attemptBlockingIO(is.read(bufArray)).asSomeError | ||
| bytes <- if (bytesRead < 0) | ||
| ZIO.fail(None) | ||
| Exit.failNone |
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.
Maybe better done as a separate PR, but maybe we should store Exit.succeed(Chunk.empty) in a val and use it below here
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.
Hehe: #9360
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.
Wow 😆
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.
Thank you 🙏
No description provided.