Skip to content
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

removed the Ref boolean #6654

Merged
merged 13 commits into from
Dec 4, 2022
Merged

Conversation

geoffjohn11
Copy link

PR to address Ref comment in #6325 (review)

@mergify mergify bot added the module:client label Sep 6, 2022
@armanbilge
Copy link
Member

Thanks for retargeting! At least according to #6325 (review) we do still need the Ref if the body is a Stream.

@geoffjohn11
Copy link
Author

@armanbilge @danicheg @kubukoz I think the ClientSuite test is missing the case for Stream Request -> Strict Response, and Stream Request -> Stream Response. I'd like to add these tests, and then will this PR be good to go?

@armanbilge
Copy link
Member

@geoffjohn11 thanks for all your work on this! Yes please, adding tests is always great, good catch.

@geoffjohn11
Copy link
Author

@armanbilge Thanks for your feedback and reviews! Hopefully this is good to go.

Comment on lines 283 to 292
refOp.fold {
Resource.suspend(Ref[F].of(false).map { disposed =>
Resource
.eval(F.pure(resp.pipeBodyThrough(until(disposed))))
.onFinalize(disposed.set(true))
})
} { disp =>
Resource
.eval(F.pure(resp.pipeBodyThrough(until(disp))))
.onFinalize(disp.set(true))
Copy link
Member

Choose a reason for hiding this comment

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

I'm a little confused by these lines.

  1. Resource.eval(F.pure(...)) is equivalent to Resource.pure(...)
  2. Since the code is the same, and there is just the issue of whether the Ref is provided or not, I think you can do refOp.fold(Ref[F].of(false))(F.pure).flatMap { disp => ... } and then share the code.

Copy link
Author

Choose a reason for hiding this comment

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

@armanbilge I think I fixed the duplication, let me know if you'd like additional changes. Thanks for the review!

@armanbilge armanbilge closed this Oct 22, 2022
@armanbilge armanbilge reopened this Oct 22, 2022
Copy link
Member

@armanbilge armanbilge left a comment

Choose a reason for hiding this comment

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

Sorry for the very slow review cycle :( I appreciate your continued work on this.

Copy link
Member

@armanbilge armanbilge left a comment

Choose a reason for hiding this comment

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

I think this is good. Thanks for all your work on it.

General comment (not related to your changes): personally I found run difficult to reason about (and thus this PR difficult to review), since it handles both requests/responses and calls itself recursively. I wonder if anyone else feels the same.

@armanbilge armanbilge merged commit 15cf19f into http4s:main Dec 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants