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

Add cancellation capabilities to IO #983

Merged
merged 11 commits into from
Aug 12, 2018
Merged

Add cancellation capabilities to IO #983

merged 11 commits into from
Aug 12, 2018

Conversation

pakoito
Copy link
Member

@pakoito pakoito commented Aug 10, 2018

Make IO have a new cancellable runAsync operator that ties into the run loop for cancellation. It improves over the old way of doing it at coroutine (flatMap) boundaries because now we can cancel after every operator call instead.

I'm tempted to make the cancellable asyncRun the default, as it has the same overhead with and without it cc @raulraja for opinion.

With cancellation and parallelism we can build races, which means we can finally have a proper concurrency framework and libraries for Android!

@pakoito pakoito requested review from javipacheco, raulraja and a team August 10, 2018 22:56
@codecov
Copy link

codecov bot commented Aug 10, 2018

Codecov Report

Merging #983 into master will increase coverage by 0.05%.
The diff coverage is 67.85%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master     #983      +/-   ##
============================================
+ Coverage     46.99%   47.04%   +0.05%     
- Complexity      672      680       +8     
============================================
  Files           313      315       +2     
  Lines          8071     8090      +19     
  Branches        822      826       +4     
============================================
+ Hits           3793     3806      +13     
- Misses         3950     3954       +4     
- Partials        328      330       +2
Impacted Files Coverage Δ Complexity Δ
...ects/data/internal/BindingCancellationException.kt 100% <ø> (ø) 1 <0> (?)
...ts/src/main/kotlin/arrow/effects/internal/Utils.kt 68.96% <0%> (-11.04%) 0 <0> (ø)
...w/effects/data/internal/IOCancellationException.kt 100% <100%> (ø) 1 <1> (?)
.../arrow-effects/src/main/kotlin/arrow/effects/IO.kt 69.11% <72.72%> (+0.15%) 11 <3> (+2) ⬆️
...effects/src/main/kotlin/arrow/effects/IORunLoop.kt 74.86% <83.33%> (+1.49%) 47 <1> (+4) ⬆️
...tics/src/main/kotlin/arrow/optics/instances/map.kt 89.18% <0%> (-2.71%) 0% <0%> (ø)

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 ddde155...82408ca. Read the comment docs.

Copy link
Member

@raulraja raulraja left a comment

Choose a reason for hiding this comment

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

Can we add this to the IO docs and a simple example of cancelation?

@pakoito
Copy link
Member Author

pakoito commented Aug 12, 2018

I'll add the docs for parallelization and cancelation after the release. My plan is that because testing this is hard we'll do a beta with some maintainers and selected projects first, and promo it once it's proven to work correctly. Maybe add @experimental for now.

@pakoito pakoito merged commit 298171f into master Aug 12, 2018
@pakoito pakoito deleted the paco-cancellableio branch August 12, 2018 12:30
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