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

Optimize Task.guarantee #913

Merged
merged 6 commits into from Jul 24, 2019

Conversation

@alexandru
Copy link
Member

commented Jun 20, 2019

Currently guarantee is based on bracket, but its implementation could be simplified and made slightly more efficient.

This is something similar to what I did for cats.effect.IO, but I forgot about it.

alexandru added 2 commits Jun 20, 2019
}

val task1 = Task
.raiseError[Int](ex)

This comment has been minimized.

Copy link
@oleg-py

oleg-py Jun 20, 2019

Collaborator

Is it scalafmt style? That separation of companion object and a factory method on different lines kinda bothers me

This comment has been minimized.

Copy link
@alexandru

alexandru Jun 20, 2019

Author Member

Unfortunately yes. Not sure what to do about it.

This comment has been minimized.

Copy link
@lorandszakacs

lorandszakacs Jun 21, 2019

Contributor

Huh, that's weird. I think you can do:

optIn {
  breaksInsideChains = false
  breakChainOnFirstMethodDot = false //pretty sure it's this one causing this.
}
alexandru added 3 commits Jun 20, 2019
@@ -152,34 +152,68 @@ object TaskBracketSuite extends BaseTestSuite {
}
}

test("bracket is stack safe") { implicit sc =>
test("bracket works with auto-cancelable run-loops") { implicit sc =>

This comment has been minimized.

Copy link
@Avasil

Avasil Jul 3, 2019

Collaborator

Would it be possible to have a test that acquire is uncancelable?

@Avasil Avasil merged commit 06364c5 into monix:master Jul 24, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
4 participants
You can’t perform that action at this time.