Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@guizmaii
Copy link
Member

No description provided.

@guizmaii guizmaii marked this pull request as ready for review November 30, 2024 07:07
Copy link
Contributor

@kyri-petrou kyri-petrou left a 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)
Copy link
Contributor

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

Copy link
Member Author

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
Copy link
Contributor

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

Copy link
Member Author

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
Copy link
Contributor

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hehe: #9360

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow 😆

@guizmaii guizmaii requested a review from kyri-petrou November 30, 2024 10:18
Copy link
Contributor

@kyri-petrou kyri-petrou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 🙏

@guizmaii guizmaii merged commit b1081ab into series/2.x Dec 1, 2024
18 checks passed
@guizmaii guizmaii deleted the one_failNone branch December 1, 2024 02:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants