Repository navigation
Conversation
| } | ||
| } | ||
| case PoolOpen(_, borrowed, m2) => | ||
| borrowed.toList.traverse { case (_, (_, destroy)) => destroy.attempt.void } >> |
There was a problem hiding this comment.
It would be nice to invoke a user-specified callback in such an unusual scenario.
E.g.
class Builder[F[_]: Temporal, A, B] private[keypool] {
...
def withOnBorrowedTermination(f: List[(A, F[Unit])] => F[Unit]): Builder
}| pm match { | ||
| case PoolClosed() => (0, Map.empty) | ||
| case PoolOpen(idleCount, m) => | ||
| case PoolOpen(idleCount, _, m) => |
There was a problem hiding this comment.
Technically, a number of borrowed connections can be a part of the exposed state. It's a binary breaking change (if we talk about KeyPool#state), but this data can be made available via another method.
Moreover, if represent a borrowed resource as (B, F[Unit], FiniteDuration), leaking resources can be spotted.
|
I've been working on something that takes this to a much further degree. The one major takeaway I've had is that you don't want this to be always true. It seems in line with the current implementation though. But this current implementation needs a lot more power to handle even more complex pooling scenarios. |
|
Well, this got lost in one of my GitHub bankruptcies, but I ran #291 and confirmed it's still an issue five years later. |
|
I can resolve conflicts, but there may be a better solution to this issue. |
f8d1542 to
0cedd16
Compare
0cedd16 to
fd88892
Compare
My attempt to fix #291