Skip to content

Conversation

@armanbilge
Copy link
Member

This change makes it possible to cancel when waiting on a resource from the pool. Previously this was not possible, so cancelation would hang until the resource became available in the pool, such that it could be immediately returned :)

Thanks to @yurique for reporting!

Comment on lines 113 to 130
recycler(a._1).onError {
case t => dispose(a) *> t.raiseError[F, Unit]
} flatMap {
recycler(a._1).onError { _ => dispose(a) } flatMap {
Copy link
Member Author

Choose a reason for hiding this comment

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

Unrelated fix, similar to #906. Skunk has a habit of re-raising errors 😅

Comment on lines +115 to +118
val wait =
poll(d.get)
.onCancel(cancel)
.flatMap(_.liftTo[F].onError(restore))
Copy link
Member Author

Choose a reason for hiding this comment

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

We need to be careful on cancelation that nobody has completed the deferred in the meantime.

@codecov-commenter
Copy link

codecov-commenter commented Jul 10, 2023

Codecov Report

Merging #919 (dc5c0cb) into series/0.6.x (4ebff30) will increase coverage by 0.04%.
The diff coverage is 100.00%.

@@               Coverage Diff                @@
##           series/0.6.x     #919      +/-   ##
================================================
+ Coverage         84.25%   84.30%   +0.04%     
================================================
  Files               126      126              
  Lines              1734     1733       -1     
  Branches            171      166       -5     
================================================
  Hits               1461     1461              
+ Misses              273      272       -1     
Files Changed Coverage Δ
modules/core/shared/src/main/scala/util/Pool.scala 100.00% <100.00%> (+4.76%) ⬆️

@mpilquist mpilquist merged commit 58f0278 into typelevel:series/0.6.x Oct 10, 2023
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.

3 participants