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

Fs2 EncodeStream for both ConcurrentEffect and Effect monads #1082

Merged
merged 1 commit into from
Mar 13, 2019

Conversation

joroKr21
Copy link
Collaborator

The ConcurrentEffect instances are prioritized higher.
This means users can benefit from cancellation when possible
without loss of generality.

@vkostyukov this is what I had in mind with providing both versions and prioritizing them. But I don't know how to test that cancellation actually works. Any ideas?

@joroKr21
Copy link
Collaborator Author

It works just fine on 2.12 😞

@codecov-io
Copy link

codecov-io commented Feb 5, 2019

Codecov Report

Merging #1082 into master will decrease coverage by 0.47%.
The diff coverage is 52.63%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1082      +/-   ##
==========================================
- Coverage   80.62%   80.15%   -0.48%     
==========================================
  Files          54       54              
  Lines        1017     1028      +11     
  Branches       59       59              
==========================================
+ Hits          820      824       +4     
- Misses        197      204       +7
Impacted Files Coverage Δ
fs2/src/main/scala/io/finch/fs2/package.scala 59.25% <52.63%> (-9.5%) ⬇️
core/src/main/scala/io/finch/Endpoint.scala 72.41% <0%> (-0.58%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b1859e0...71c006a. Read the comment docs.

Copy link
Collaborator

@vkostyukov vkostyukov left a comment

Choose a reason for hiding this comment

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

I like this @joroKr21! Does this slow down compilation at all? We've been trying to be careful with introducing more complexity that could potentially slow down the implicit resolution.

@rpless @sergeykolbasov Mind taking a look?

@joroKr21
Copy link
Collaborator Author

I'm not too concerned about compile times. After scala/scala#7067 implicits in Scala 2.12 and 2.13 are not that expensive anymore.

I'm more concerned about:

  1. How to test cancellation actually works?
  2. How to document the behavior (although that not be as bad if we think about this as an optimization).

@vkostyukov
Copy link
Collaborator

@joroKr21 Mind rebasing this?

The `ConcurrentEffect` instances are prioritized higher.
This means users can benefit from cancellation when possible
without loss of generality.
@sergeykolbasov
Copy link
Collaborator

sergeykolbasov commented Mar 13, 2019

👍

I just solved the Fiber and bracketCase for stream cancellation on my own and then re-checked this PR. Oops 😄

On cancellation test topic, could we get some inspiration from cats-effect laws: https://github.com/typelevel/cats-effect/blob/master/laws/shared/src/test/scala/cats/effect/IOCancelableTests.scala#L76-L89 ?

@vkostyukov
Copy link
Collaborator

FWIW, I'm happy if we decide to add a specific cancelation test later, in the upcoming commit. Let's merge this, it's been on review for quite some time.

@vkostyukov vkostyukov merged commit 4f6a52a into finagle:master Mar 13, 2019
@joroKr21 joroKr21 deleted the encode-stream-concurrent branch March 14, 2019 09:07
@joroKr21
Copy link
Collaborator Author

On cancellation test topic, could we get some inspiration from cats-effect laws: https://github.com/typelevel/cats-effect/blob/master/laws/shared/src/test/scala/cats/effect/IOCancelableTests.scala#L76-L89 ?

First we have to migrate the tests to use a TestContext which can tick.

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.

4 participants