-
-
Notifications
You must be signed in to change notification settings - Fork 15
Open
Labels
Description
commons-pool2 functionality
In commons-pool2, borrowObject, when no object is available, it may immediately raise an error or block for a specified duration, depending on the blockWhenExhausted property.
Current behavior
keypool effectively hardcodes this to true with semantic blocking. The effect can be canceled, so the duration can be emulated with a simple Cats Effect timeout. There is not presently a way to immediately fail, similar to tryAcquire on a Semaphore.
Analysis
It is not clear why this should be a property on the pool rather than an operation on the caller. A tryTake: Resource[F, Option[Managed[F]] is a possibility.
Workarounds
timeout with a short enough duration to not introduce lag, but a long enough duration to not generate false positives.