Implement blockWhenExhausted
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 25/100
Research direction
Start by examining the pool's existing borrow/take operation and how Cats Effect cancellation and timeout are used. Compare the desired behavior with commons-pool2's blockWhenExhausted and the suggested tryTake: Resource[F, Option[Managed[F]]]. Done requires an agreed API and semantics for immediate failure versus bounded blocking, plus corresponding tests.
Written by the indexing model from the issue text.
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.
- Dominant language
- Scala
- Stars
- 39
- Forks
- 18
- Avg merge
- 8h 26m
- Merged PRs (30d)
- 4
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from typelevel/keypool
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
-
PoolSpec flake Open
Difficulty 3/5 1-2 days Newbie friendliness 35/100
-
commons-pool2 parity
Difficulty 5/5 Over a week Newbie friendliness 25/100
-
bug
Difficulty 3/5 1-2 days Newbie friendliness 42/100
-
Difficulty 4/5 3-5 days Newbie friendliness 45/100
All issues in typelevel/keypool
Similar issues
-
Area: Excel support
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
orbeon/orbeon-forms#7893 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
lichess-org/lila#21788 · 2 comments ·
-
area:Iceberg area:writer documentation requires-triage
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
apache/datafusion-comet#6147 ·
-
feature
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
GiganticMinecraft/SeichiAssist#2978 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
chipsalliance/rocket-chip#3833 ·