-
Notifications
You must be signed in to change notification settings - Fork 520
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 a memoizedAcquire
method to Resource
#4105
base: series/3.x
Are you sure you want to change the base?
Conversation
val fa2 = F.uncancelable { poll => | ||
poll(allocatedCase).flatMap { case (a, r) => release.update(r :: _).as(a) } | ||
} | ||
Resource.makeCaseFull[F, F[B]](poll => poll(F.memoize(fa2)).map(_.widen)) { (_, exit) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@durban @armanbilge I applied the change here, to ensure acquisition will not be cancelled once F.memoize(fa2)
has been successfully run. I tried to come up with a test to ensure the behavior but could not find any reliable way to write something that tries to cancel it at the right time.
Do you have an idea on how I could write such a test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do you have an idea on how I could write such a test?
#3425 is an example of a similar PR. Notice the special use of the test runtime.
TestControl.executeEmbed(go, IORuntimeConfig(1, 2))
Further reading:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, I will have a look at this.
memoizedAcquire
method to Resource
memoizedAcquire
method to Resource
I did not forget about this PR. Testing it is currently blocked by the |
As mentioned in #3890 (comment), this is the PR taking over #3890 to add a specialized version of
memoized
forResource
.Ref #3513